[英]MongoDB Bulk Update is slow
I'm running Mongo 2.6.3 I'm updating about 900 records, and sometimes up to 5000 records. 我正在运行Mongo 2.6.3我正在更新大约900条记录,有时甚至多达5000条记录。 I had this in a loop before, and for 900 records the upserts took about 1 minute to complete.
我之前在循环中有这个,并且对于900个记录,upserts花了大约1分钟来完成。
Right now, I'm using the initializeUnorderedBulkOp API and it's taking about 40 seconds for 900 records. 现在,我正在使用initializeUnorderedBulkOp API,它为900条记录花了大约40秒。 Why is it so slow?
为什么这么慢?
I basically have 我基本上有
var batch = collection.initializeUnorderedBulkOp({useLegacyOps: true});
// for loop
batch.find(query).upsert().updateOne({my object});
batch.execute({w:0},function(err, result) {
This is using the node driver. 这是使用节点驱动程序。 Screenshot of my network panel for these calls http://cl.ly/image/0L2a0o0w1I1b
这些调用的网络面板的屏幕截图http://cl.ly/image/0L2a0o0w1I1b
When the data is smaller, it takes less time, so it's definitely a number of records problem. 当数据较小时,花费的时间较少,因此肯定存在许多记录问题。 Lastly, my objects are not huge, they are maybe 9 keys or so, no big data.
最后,我的对象并不大,它们可能是9键左右,没有大数据。
Any ideas on how to get this time down? 关于如何缩短这个时间的任何想法?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.