S3 architecture: 3 years of evolution for Mail.ru Cloud Storage



Storage Corridor by St-Pete



Hello! I'm Mons Anderson, the architect of the Mail.ru Cloud Solutions platform , and I'll tell you how we built our S3 storage, how it works, which solutions turned out to be successful, and which ones would be worth changing if we started the same project from scratch now.



@Databases Meetup by Mail.ru Cloud Solutions & Tarantool. :



  • Mail.ru, S3-;
  • , Mail.ru Cloud Storage;
  • ;
  • : ;
  • ;
  • SSL-.


, .



Mail.ru, S3-



S3 Mail.ru, , .



Mail.ru . storage- โ€” 36 12โ€“14 . , .



ยซยป (pair). โ€” unit . , , , , .



โ€” , , . , , 3/2.





(pair) โ€”



PairDB โ€” Tarantool. , , โ€” Tarantool, .



PairDB , , , , . , , , . PairDB โ€” .





Pair DB:



, , , , โ€” FileDB. , : - -, .



File DB: ,

โ€” Nylon, . , PairDB, FileDB. stateless-, , , FileDB , , , .





Nylon:



- . โ€” Streamer. HTTP-: PUT, , GET, . HTTP โ€” .



Streamer'y, Nylon PairDB, , , WebDAV .



, storage โ€” nginx , . Streamer , , . .





Streamer:



, S3-



, , S3-. PUT . . S3. S3, , :



  • โ€” ;
  • HTTP;
  • โ€” ;
  • HTTP-S3 Endpoint. S3 โ€” , .


. .





, S3 API. S3 API Amazon, XML . - , .



Nginx. SSL, , Lua (, ).



S3 Tarantool. S3 , Streamer.



Nginx + S3 API + Metadata

Nginx + S3 API +





, S3. โ€” . . . URL. โ€” blob, , . : โ€” URL, ACL ( ), โ€” .



: , , . , : uploads chunks. .



Data schema



b2b- , .

Tarantool.



Billing



S3-:



, : , .



-. , - . - : S3- , , - . , -.



, - , , S3.



Tarantool. - โ€” 21 , , . : -, . . , , . , Token Bucket. -, , , , . S3-, .



Rate Limit System



. S3 , . : Streamer, FileDB, PairDB, Storage. .



nginx, , SSD RAM-. Tarantool, , . , 32 , Tarantool .



Data cache



, , capacity (), , , , .



:



, - โ€” .



S3- Tarantool. Tarantool, - . , API, โ€” Tarantool, . , . .



Active failover



,



, โ€” . , .



: , , . , , . , , , . , .



Brought objects that make no sense to shard



, โ€” , . .



Growing objects carried away to a sharded cluster



, : , ACL. . , , , .



:



  • , , ;
  • , , ;
  • lifecycle โ€” , , .


Final sharded scheme



, . , , , , .



Sharing proxy



, , .



, . 256 . . โ€” , , :



f(bucket, shards) = subset



, , . map-reduce , , , . , . , , .



โ€” , , . , :



f(object, subset) = shard



, , โ€” .



Bucket sharding scheme



, , . . , โ€” , , .



Final sharding scheme





โ€” . , . , .



, . nginx, S3 API, , primary- ,



hotbox



, : ยซ , , โ€” , ยป. , , URL .



Hot and cold storage



Icebox , Hotbox, - . Hotbox Icebox , .



, , , , , . . .



primary-. Tarantool :



  • , Hotbox;
  • Tarantool ( โ€” Icebox), ;
  • , , , .

    Synchronizing buckets



, , , , . , Hotbox, Icebox โ€” , .



Migrating, , , , .



. API Icebox, Hotbox, , Nginx.



, , Nginx API Icebox .

Icebox nginx S3 API โ€” :



Switching incoming requests



, โ€” , Migrating, Local.



Data migration



, , .



Cleaning Legacy



:



  • Non-sharded. , .
  • Sharded.
  • , Migrating .


:



  • , .
  • .
  • : , , .


SSL-



Nginx. Nginx, OpenResty, Nginx LuaJIT.

โ€” SSL-. S3- , CNAME. HTTPS : SSL-.



, SSL Nginx. Nginx, OpenResty, Nginx LuaJIT.



Nginx . ( ). ssl_certificate_by_lua, TLS-. Tarantool: .



, , Let's Encrypt.



SSL certificate storage



, -,





. . , , , , , , . .



Tarantool . . , .



. , , . S3 .



S3 ยซยป. , . .



. , , , , .





. , Amazon, , .



. , .



Tarantool. Tarantool , , , .



@Databases Meetup by Mail.ru Cloud Solutions&Tarantool. Telegram Kubernetes Mail.ru Group.

, S3 .






All Articles