With only few dozens of parameters in the configuration file (mongo.conf) and a dozen that are actually related to performance tuning, it may be a relatively short task to tune a mongoDB configuration file. Probably some of us will pay for that in production...
NOTE: this post does not refer the Sharding configuration.
What Can be Done?
Number of Connections
Like many other products (Apache httpd, MySQL...) the number of user connections can affect performance. mongoDB supports that using maxConns = N. Numbers can reach 20,000, but you should adjust it to your own server resources.
Write to Disk
You should notice the following two options:
- Delay journal (database log) write to disk using journalCommitInterval = 300. This parameter supports intervals between 2ms (slowest but safest for recovery) and 300ms (fastest but prone to recovery options). The default os 100ms, but you may increase it to 300ms to save resources.
- Preallicate space at mongoDB startup by keeping noprealloc = false.
mongoDB provides many supporting services. Disabling some of them (if you do not use them), may help you save some CPU cycles:
- BSON validation using objcheck = false.
- HTTP Interface using nohttpinterface = true. The mongoDB HTTP interface exposes the database statistics and enables simple REST queries through port 28017.
- REST service using rest = false. See in the HTTP interface.
- Profiling service (inc. slow queries logging) using profile = 0.
mongoDB is a simple, yet very effective tool to solve many business needs. Doing some tuning will help you avoid issues during peak times.