mongodbmongorestore

Does mongod run in a single thread when performing a mongorestore?


When monitoring a mongodb restore, I'm tracking two processes...

CPU   COMMAND
100%  mongod --config /etc/mongo/mongod.conf
0%    mongorestore /data/dump

MongoDB is 4.4.14 and mongorestore is version is 100.5.3. I'm running it inside a docker container.

I never see mongod go past 100%.. Is there a way to allow it to use more than a single core when performing a mongo restore?


Solution

  • By default mongorestore will restore max 4x collections in paralel with single insertionWorkerPerCollection( Since you see only two processes running in paralel , perhaps you have only 2x collections in your database... ) , but you can increase this parameters if you have more collections and would like to restore faster , check the official docs for details:

    --numParalelCollections ( default=4 )

    Number of collections mongorestore should restore in parallel.

    --numInsertionWorkersPerCollection ( default=1 )

    Specifies the number of insertion workers to run concurrently per collection. For large imports, increasing the number of insertion workers may increase the speed of the import.