[英]MongoDb journal in write concern
I wrote a test program to check mongodb write performance with or without journaling: Items to be inserted: 10000 我编写了一个测试程序,用于检查mongodb写入性能是否有日记:要插入的项目:10000
case1: insert with (w = 1, j = 1)
result: 10000 documents inserted in 340,620 ms (about 29 documents per second) case1:插入
(w = 1, j = 1)
结果:在340,620毫秒内插入10000个文件(每秒约29个文件)
case2: insert with (w = 0, j = 1)
result: 10000 documents inserted in 360ms (about 27700 documents per second) case2:插入
(w = 0, j = 1)
结果:以360ms插入10000个文档(每秒约27700个文档)
What does (w = 0, j = 1)
mean? (w = 0, j = 1)
是什么意思?
do we have durability in case2? 我们在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
. 假设在最后一个版本中记录的工作没有改变,我相信你所看到的是
w=0
的速度。 Since you have w=0
( http://docs.mongodb.org/manual/core/write-concern/#unacknowledged ) you are only acknowledging that the command was sent to the MongoDB instance(s). 由于您有
w=0
( http://docs.mongodb.org/manual/core/write-concern/#unacknowledged ),您只是确认该命令已发送到MongoDB实例。
The behaviour of w=0
was changed from socket acknowledged in earlier versions of MongoDB which could not mitigate network errors because of that. w=0
的行为已从早期版本的MongoDB中确认的套接字更改,因此无法缓解网络错误。
So the value of w=0
is overriding the value of j=1
and causing unacknowledged writes, however, the durability should theorticially be the same since j=1
still causes: 因此,
w=0
的值会覆盖j=1
的值并导致未确认的写入,但是,由于j=1
仍然导致持久性应该是主体相同的:
http://docs.mongodb.org/manual/core/write-concern/#journaled http://docs.mongodb.org/manual/core/write-concern/#journaled
MongoDB also increases the frequency that it commits operations to the journal.
MongoDB还增加了它向日志提交操作的频率。
But: 但:
Unacknowledged is similar to errors ignored;
未确认类似于忽略的错误; however, drivers will attempt to receive and handle network errors when possible.
但是,驱动程序将尽可能尝试接收和处理网络错误。
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 (old w=0
) which could lose massive amounts of writes. 当然,它不如实际执行
w=1
那么好,但它没有socket承认(旧w=0
)那样可能会丢失大量写入。
So you are getting the speed of w=0
with short intervals to journal as if they are all journal acknowledged. 所以你得到
w=0
的速度,间隔时间很短,就好像它们都是日记记录一样。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.