Tuesday, August 13, 2013

Example of how to set JournalCommitInterval in MongoDB

I have found no way yet to find the current value of journalCommitInterval.

But, I have found how to set the journalCommitInterval.

We've got our mongodb set up to use a local disk for our journal, and data resides on a SAN-mounted mount point.

We'd like to set our journalCommitInterval up to a larger value to cut down on the IOPS to our local disk. This might have the added benefit of helping us run faster.

I've run the following command against a mongos, and it complains:

mongos> db.adminCommand({ "setParameter" : 1, "journalCommitInterval": 499});
{ "ok" : 0, "errmsg" : "journaling is off" }
When I run this against a specific daemon, it works up to a value of 499 (setting it to 500 generates a complaint/error):
shard-000:PRIMARY> db.adminCommand({ "setParameter" : 1, "journalCommitInterval": 499});
{ "ok" : 1 }
I have posed the follwoing questions to 10Gen:
  • Question 1: do I need to run this against each mongod individually?
  • Answer 1: Yes.
  • Question 2: does this persist across restarts of the daemon?
  • Answer 2: No. That daemon's journalCommitInterval returns to its default when a daemon are restarted. Thus, it's better to set it in the config file you have defined for the shard. Or, if you define it via command line, do something like:
    /path/to/mongod --journalCommitInterval=499 ...
    
I have just created a minor request in core-server to expose the current value so we can verify it has been set correctly on all shards. If you agree this would be a handy feature to have, please watch and VOTE on the case, https://jira.mongodb.org/browse/SERVER-10508

No comments: