I try to uderstand how journaling is exactly working : is that correct ?
When no journaling is activated on the server side (mongod --nojournal) :<ol><li>(a) If the client request a journaled write it will output an error (from 2.6, before it was ignored),</li> <li>(b) If the client request a non journaled write, journaling will not be used so I guess change will be made on RAM, then the OS will flush changes to data file evry 60s.</li> </ol>
When journaling is activated on Mongod (mongod --journal (default on 64 bits version):<ol><li>(a) If the client request a journaled write, mongoDB will acknowledge write in the master node only after commiting data into journal, also so as to make the client not to take too much time to perfrom the write, Mongod will reduce the commit interval. </li> <li>(b) If the client request a non journaled write, mongoDB will use the journal and acknowledge write from the master node without waiting the data to be committed to the journal.</li> </ol>
I actually did not find anything in the official documentation about case 2(b), could someone confirm if journal is used when j is false on the client side but journaling is activated on the mongod ?Answer1:
Your assertions are all correct. I think the language you are using is confusing and may be confusing you a little bit, however. Clients don't request writes that are journaled or non-journaled. If journaling is on, writes will be journaled, regardless of what the client does. What the client includes is a <a href="http://docs.mongodb.org/manual/reference/write-concern/" rel="nofollow">write concern</a> that requires a certain level of data replication (the
w parameter) and/or journaling (the
j parameter) before the server responds that the write is a success. What you mean by a non-journaled write is
j = 0, which means the server will respond with success without waiting for the write to be committed to the journal;
j = 1 means the server will not respond to the write until it has been committed to the journal.
w parameter controls the level of replication of the data necessary for a successful response. There's more detail in the link above.