Can MongoDB use multi-core?

I am studying MongoDB.
And I read this.

MongoDB is capable of multi-core for read jobs, but insert jobs is capable of single-core only.
(But I think it will work multi-core for bulk write jobs.)

The article was written in 2011~2015.
Is the current MongoDB the same?

Hi @Kim_Hakseon,

The MongoDB server is (and has always been) multithreaded and can take advantage of multiple cores, but the WiredTiger storage engine (added in 2015) greatly improves concurrency and resource utilisation compared to the older MMAPv1 storage engine which an article circa 2011-2015 is probably referring to. I strongly recommend studying recent articles and documentation, as 7+ year old information is almost certainly outdated.

Operations on a single connection are typically not going to use all available cores as it would generally be undesirable for a single connection to consume all server resources. However, more cores can increase the throughput of concurrent operations per the MongoDB Production Notes on WiredTiger:

The WiredTiger storage engine is multithreaded and can take advantage of additional CPU cores. Specifically, the total number of active threads (i.e. concurrent operations) relative to the number of available CPUs can impact performance

You can also utilise multiple threads in your client application to parallelise operations such as inserts. For example, mongorestore has options like numInsertionWorkersPerCollection to control concurrent requests.

Related discussion: Will MongoDB utilize all my 4 CPUs? - #4 by Stennie_X.

Regards,
Stennie

1 Like

I could understand it to some extent by looking at your explanation, the writing of the forum you linked, and the manual.

Thank you for your quick and accurate reply.
Have a good day today. :smiley:

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.