Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

MongoDB Configuration File Tuning

DZone's Guide to

MongoDB Configuration File Tuning

· Database Zone
Free Resource

Whether you work in SQL Server Management Studio or Visual Studio, Redgate tools integrate with your existing infrastructure, enabling you to align DevOps for your applications with DevOps for your SQL Server databases. Discover true Database DevOps, brought to you in partnership with Redgate.

For those of us who are regular to MySQL, its configuration file (my.cnf) and the many options in it (some may say too many), mongoDB seems to be the simple.
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
Disk writing is usually a bottleneck in database systems. Therefore, wrtie to disk frequency and initial storage allocation can highly effect your system performance. Yet notice that delaying disk writing can effect your system recovery (many of you probably familiar with it from MySQL).
You should notice the following two options:

  1. 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.
  2. Preallicate space at mongoDB startup by keeping noprealloc = false.
Disable Services
mongoDB provides many supporting services. Disabling some of them (if you do not use them), may help you save some CPU cycles:
  1. BSON validation using objcheck = false.
  2. HTTP Interface using nohttpinterface = true.
  3. Scripting Engine using noscripting = true.
  4. REST service using rest = false.
  5. Profiling service (inc. slow queries logging) using profile = 0.
Bottom Line
mongoDB is a simple, yet very effective tool to solve many business needs. Doing some tuning will help you avoid issues during peak times.

 

It’s easier than you think to extend DevOps practices to SQL Server with Redgate tools. Discover how to introduce true Database DevOps, brought to you in partnership with Redgate

Topics:

Published at DZone with permission of Moshe Kaplan, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}