4

Would anyone happen to know why Mongo is just using one core instead of distributing traffic on all?

I am using the PyMongo driver and MongoDB is running on a centos server.

enter image description here

  • what is the workload? are you doing counts/sorts, something else? – Adam C Dec 20 '15 at 1:23
  • Hi @AdamComerford yes I am using counts and sorts during reads – Jonathan Dec 20 '15 at 1:24
  • Is your dataset a light one? I mean in the order few megabytes (less than 100 MB) – harshavmb Dec 20 '15 at 21:35
1

There is no such notion as CPU "traffic". A single thread runs on a single Core. Always. While a single core can execute multiple threads and even multiple processes, a single thread can not be split to be executed among multiple cores. That would require the system to understand the purpose of the program, which would be a pretty frightening thing.

So let us assume you have 4 threads and 4 Cores. Now let us assume 3 of those threads do not have much to do (one is logging, one is listening for configuration changes and one accepts new connections and spawn additional threads dealing with those connections), but the other one really has to do some computation. The core the computational intensive thread is attached to will have a higher utilization. And this behavior is even intended – or would you want the system to slow down in accepting new connections just because somebody makes a computational intensive request?

| improve this answer | |
0

Hi as per your comments you are doing sorting in your query which is actually using your 1 core of CPU and its normal. Even in SQL server also same things happens you can check below link it is for SQL but same things applies in Document based DB.

http://www.brentozar.com/archive/2013/02/7-things-developers-should-know-about-sql-server/

| improve this answer | |
  • 3
    The remark about SQL Server is not correct, and Brent's article does not support it. SQL Server can indeed use multiple cores to perform a single sort in a parallel plan. MongoDB may be limited to single-threaded execution, I don't know. – Paul White 9 Jan 2 '16 at 11:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy