2015-08-19

MongoDB - Performance optimization tips


  1. Issue updates to specific fields, avoid retrieving the entire document.
  2. Avoid negation in queries... MongoDB does not index the absence of values.
  3. Test/explain every query in your application with explain().
    1. Eliminate unnecessary indexes.
    2. Use covered queries when possible (queries that exclusively retrieve values that are indexed)
  4. Make sure to use the latest available MongoDB drivers.
  5. Store all data for a record in a single document.
  6. Avoid large documents (use GridFS if you must).
  7. Manually pad your documents with fields that may later on exist. This helps the Mongo engine from having to move/re-write the document in a separate disk location.
  8. Avoid large indexed arrays.
  9. Avoid long field names (repeated field names add-up, and take space!).
  10. Avoid creating separate indexes for fields already found in compounded indexes.
  11. Store indexes in a separate disk/volume.
  12. Use EXT4 or XFS files systems (avoid EXT3).
  13. Use RAID10 (not RAID0, nor RAID5)

Taken from "Performance Best Practicers for MongoDB", MongoDB 3.0, August 2015.

No comments:

Post a Comment