ºÝºÝߣ

ºÝºÝߣShare a Scribd company logo
MongoDB
                 At MercadoLibre



Wh at h ave we le a rned
Overview

About MeLi

Why MongoDB?

Use cases

Lessons Learned

Wrapping Up
MeLi - Platform
MeLi - Facts!
20M requests / minute
 50K requests / sec (peaks)
 4 Gb bandwidth / sec
MeLi - Facts!
20M requests / minute
 50K requests / sec (peaks)
 4 Gb bandwidth / sec


Our farm
 +1000 physical server
 +6000 virtual instances
MeLi - Inside

Lot of fun here playing with new stuff :P
MeLi - Inside

Lot of fun here playing with new stuff :P
Our NoSQL stack

 Redis
 Memcached
 Hadoop
MeLi - Inside

Lot of fun here playing with new stuff :P
Our NoSQL stack

 Redis
 Memcached
 Hadoop
 .... and of course
Why MongoDB?


Horizontal Scaling

High Availability

Performance

Flexible Data!
Why MongoDB?


Horizontal Scaling

High Availability

Performance

Flexible Data!
Why MongoDB?
(... and more)

   JavaScript(¡®ing)

   Polyglot

   Open Source

   Awesome Community

   Support
Support :-)
Use Cases

   DB      Documents

 Social     +700M

 Orders     +23M

Feedback     +3M

 Emails     +61M

 Items     +200M

Logging     +332M
Use Case: Social

Store Meli¡¯s users social data
LOT of data (friends, likes, ...)
> 500 Gb
> 700 M documents
12 shards servers : 4 replica set
Each replica set = 3 servers
80Gb per instance
Use Case: Social
                                     Sp
                                        ec
                                    @T ial
                                      ioB thk
                                          or     st
Store Meli¡¯s users social data               rac o
                                                ho
LOT of data (friends, likes, ...)
> 500 Gb
> 700 M documents
12 shards servers : 4 replica set
Each replica set = 3 servers
80Gb per instance
Use Case: Items



1 Item!
Use Case: Items



1 Item!
Use Case: Items



1 Item!
Use Case: Items



     1 Item!
N x N x N ... > 100k rows
Use Case: Items



1 Item!
Use Case: Logging
                            Capped Collections!
Info logs
  RabbitMQ messages
  Track certain use cases

Errors logs
 Something bad happen...
 Recuperable errors with retry handler
Lessons Learned
Storage
  File System
    NSF: Bad choice, Poor results
    Ext4: Far much better

  Mount Options
  Reducing Disk IO by mounting partitions with noatime and nodiratime

  Track disk performance
  iostat -xm 2 (%util column < 100%)
Lessons Learned
VM¡¯s
  Shard instances
   4 cores
   >= 16 Gb ram

  Config server
   low cpu consumption
   1Gb ram / 1Gb storage


  Mongos
   runs along with the webserver (client)
   1 mongos x webserver
Lessons Learned
Monitoring
 Disk usage (with zenoss)
 Ping health check
    curl --connect-timeout 3 
         --write-out %{http_code} 
         --silent 
         --output /dev/null 
         http://localhost:28017/_status
Lessons Learned
Monitoring                MMS - It¡¯s free!
Lessons Learned
Plan your actions!
   Shard key
   Upgrades
   Cfg Servers
                 +   bad decisions = Lot of rework
   ...
Lessons Learned
Plan your actions!
   Shard key
   Upgrades
   Cfg Servers
                 +   bad decisions = Lot of rework
   ...


   Study
                     Think
                               Plan

                                           Hands On!
Wrapping Up!


Meli loves MongoDB!
The End


            Questions?

   {?
        name ? ? :?"Pablo Molnar",??
        title ? ?: "Software Engineer",
        work ? ?:?"MercadoLibre",
        location : "Buenos Aires",
        twitter ?: "@pablomolnar"
   }

More Related Content

MongoDB at MercadoLibre

Editor's Notes

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. \n
  25. \n
  26. \n
  27. \n
  28. \n