I wrote a test program to check mongodb write performance with or without journaling: Items to be inserted: 10000
case1:
insert with (w = 1, j = 1)
result: 10000 documents inserted in 340,620 ms (about 29 documents per second)
case2:
insert with (w = 0, j = 1)
result: 10000 documents inserted in 360ms (about 27700 documents per second)
What does (w = 0, j = 1)
mean?
do we have durability in case2?
Providing that the working of journaled has not changed in the last version I believe what you are seeing is the speed of
w=0
. Since you havew=0
( http://docs.mongodb.org/manual/core/write-concern/#unacknowledged ) you are only acknowledging that the command was sent to the MongoDB instance(s).The behaviour of
w=0
was changed from socket acknowledged in earlier versions of MongoDB which could not mitigate network errors because of that.So the value of
w=0
is overriding the value ofj=1
and causing unacknowledged writes, however, the durability should theorticially be the same sincej=1
still causes:http://docs.mongodb.org/manual/core/write-concern/#journaled
But:
Good to note that "errors ignored". If you get an error while updating/inserting them you would not be told about it, but ignoring documents with errors, your durability should be relatively the same.
Of course, it is not as good as actually doing a
w=1
but it is not as bad as socket acknowledged (oldw=0
) which could lose massive amounts of writes.So you are getting the speed of
w=0
with short intervals to journal as if they are all journal acknowledged.