For example, if I have 200,000 documents, starting with _id:0 to _id:199,999 and using 2 mongoexport processes:mongoexport -q '{"_id":{"$gte":0, "$lt":100000}}' -d test -c test > out1.json &mongoexport -q '{"_id":{"$gte":100000, "$lt":200000}}' -d test -c test > out2.json &在上面的示例中,两个 mongoexport 进程各自处理集合的一半.where in the above example, the two mongoexport processes are each handling one half of the collection.使用 1 个流程、2 个流程、4 个流程和 8 个流程测试此工作流程,我得出以下时间点:Testing this workflow with 1 process, 2 processes, 4 processes, and 8 processes I arrive at the following timings:使用 1 个进程:real 0m32.720suser 0m33.900ssys 0m0.540s2 个进程:real 0m16.528suser 0m17.068ssys 0m0.300s4 个进程:real 0m8.441suser 0m8.644ssys 0m0.140s8 个进程:real 0m5.069suser 0m4.520ssys 0m0.364s根据可用资源,并行运行 8 个 mongoexport 进程似乎可以将进程加速约 6 倍.这是在 8 核机器上测试的.Depending on the available resources, running 8 mongoexport processes in parallel seems to speed up the process by a factor of ~6. This was tested in a machine with 8 cores.注意:halfer 的答案在思想上是相似的,尽管这个答案基本上是试图看看并行调用 mongoexport 是否有任何好处.Note: halfer's answer is similar in idea, although this answer basically tries to see if there's any benefit in calling mongoexport in parallel. 这篇关于是否有可能提高 Mongoexport 的速度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 07-29 20:21