Disabling journal commit for a specific collection.

114 views
Skip to first unread message

ssen

unread,
May 9, 2016, 11:02:08 PM5/9/16
to mongodb-user
Hi,
I am a bit confused about the sequence of mongod journal operation with respect to write concern values.
As per my understanding journal write happens first in private view and then the shared data view gets updated.
1. With w=default , journal=true, does the write gets blocked until journal update actually happens which is 100 ms by default?
2. With w=default and journal=false, does the write return before actual journal write happens, but journal write still happens in the background.

Also Is it possible to disable journal commit for a specific mongod collection while leaving it on for others?
 
Thanks,

Kevin Adistambha

unread,
May 12, 2016, 3:57:11 AM5/12/16
to mongodb-user

Hi,

I am a bit confused about the sequence of mongod journal operation with respect to write concern values.
As per my understanding journal write happens first in private view and then the shared data view gets updated.

There are some differences in journaling behavior with regards to write concern settings between MongoDB versions, storage engines, and deployment topology (e.g. standalone or replica set). The behavior you are describing is correct for MMAPv1 storage engine only, since MMAPv1 requires the journal and the private view to recover to a consistent state in the event of a crash. The WiredTiger storage engine uses journaling differently since it uses checkpoints to provide data consistency.

  1. With w=default , journal=true, does the write gets blocked until journal update actually happens which is 100 ms by default?

I’m assuming that by w:default you meant w:1, which is the default w setting in MongoDB. I’m also basing the answers on MongoDB 3.2.

From the page storage.journal.commitIntervalMs:

  • In MMAPv1, setting a write operation with w:1, j:true alters the journaling interval to 1/3 of its value (this is 100 ms by default if the journal and the data files are located within the same block device). Therefore, if you specify write concern of w:1, j:true, the journal commit interval will be approximately 33 ms.
  • In WiredTiger, setting a write operation with w:1, j:true will cause an immediate sync of the journal
  1. With w=default and journal=false, does the write return before actual journal write happens, but journal write still happens in the background.

Yes this is correct.

Also Is it possible to disable journal commit for a specific mongod collection while leaving it on for others?

No, the journal setting is set per mongod, and cannot be set per-database or per-collection.

For a general overview on how journaling works in MMAPv1 and WiredTiger, please see the Journaling page.

Best regards,
Kevin

Reply all
Reply to author
Forward
0 new messages