MongoDB Scaling Tips

Quick list of things to check for optimizing MongoDB performance:

  • Use NVMe SSD storage (on AWS, this means i2/i3 instances)
  • Use WiredTiger storage engine
  • Use at least some OS swap space (< size of RAM is okay, but at least a few GB seems to help prevent OOM kills)
  • Check for warning messages in the mongod startup log
  • Don’t run slow analytics queries on the production database (set up streaming ETL to a separate database)
  • Don’t run backups on the master of a replica set
  • Check working set size vs RAM and disk
  • Batch reads/writes where possible
  • Optimize write concern settings
  • Try to avoid linear growth of working set size (e.g. by laying off historical data to cold storage)
  • Check query plans for mis-optimized queries
  • Add parallelism as necessary (collection/database/service)

Leave a Reply

Your email address will not be published. Required fields are marked *