1

I'm building an application for a single user, the user is mostly counting documents based on certain criteria. The data are hold on a server in memory (16 cores, 512GB RAM).

The data are in a single collection of documents with a typical depth of 3 and the size of the JSON range from 20 to 50KB. A typical query willfilter documents over three or four fields, but they could be significantly more complex.

From my understanding of MongoDBs architecture, if I want to obtain the best performance, I should split my data between 16 shards, 1 per core. Am I right in my assumption?

Guillaume
  • 301
  • 3
  • 4
  • possible duplicate of [MongoDB: Sharding on single machine. Does it make sense?](http://stackoverflow.com/questions/6477613/mongodb-sharding-on-single-machine-does-it-make-sense) – kirelagin Jun 09 '13 at 16:58
  • Possible, but my question was more related to querying the data not inserting them. – Guillaume Jun 09 '13 at 17:06
  • Hm, so your database is, basically, read-only? – kirelagin Jun 09 '13 at 17:11
  • The data are updated once per quarter, adding a few 100,000s documents. – Guillaume Jun 09 '13 at 17:17
  • it makes no sense at all to do what you propose since reading the data is in no way CPU intensive - and especially if the same data is being read - different cores can handle multiple threads all accessing the same data sharing a read lock. I'm not sure what reading you are referring to that suggested something like that. – Asya Kamsky Jun 10 '13 at 04:08
  • 1
    A very long time ago MongoDB used to be contained to a single core and you had to install multiple MongoDBs via virtual machines and what not to get the power of all your cores, but that was a long time ago and is no longer the case – Sammaye Jun 10 '13 at 09:14
  • If the data where on disk, the load would be on the IO side. But in my use case the data would reside in memory. So the limit has to be either the memory bandwidth or on the CPU side. If you take into account that the memory bandwidth is around 25GB/s, the is more chance that the limit is on applying the query criteria. – Guillaume Jun 14 '13 at 08:22
  • My understanding is that MongoDB can use multiple cores when queries are run in parallel, not sequentially. So if I would run 16 queries in parallel I would be fine, but that's not something I can do. – Guillaume Jun 14 '13 at 08:28
  • Think I've found a [confirmation](http://stackoverflow.com/questions/11748872/mongodb-map-reduce-on-multicore-server) of sort. – Guillaume Jun 14 '13 at 08:30

0 Answers0