Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

From the doc , it said

"For best performance, the majority of your active set should fit in RAM."

So for example, my db.stats() give me

"db" : "mydb",
"collections" : 16,
"objects" : 21452,
"avgObjSize" : 768.0516501957859,
"dataSize" : 16476244,
"storageSize" : 25385984,
"numExtents" : 43,
"indexes" : 70,
"indexSize" : 15450112,
"fileSize" : 469762048,
"ok" : 1

Which value is the working set size?

share|improve this question
up vote 5 down vote accepted

The SO question/answer linked by quanta in the comments is correct, the "Working set" is basically the amount of data AND indexes that will be active/in use by your system.

You cannot tell from db.stats() what that will be unless you think that you will need to have the entire set of data and the entire index in RAM. That is, you can work out the maximum working set for that database, but not the actual active working set. The maximum is the sum of:

  1. dataSize - The total size of the data held in this database
  2. indexSize - The total size of all indexes created on this database

In your case, that maximum would be approximately 30.45 MiB given the output you pasted.

For tracking the actual memory usage I would recommend a combination of the figures from db.stats() and the memory graphs (resident memory in particular) available in the free monitoring tool - MMS.

Update (04/08/2013):

Version 2.4 added a Working Set Size Estimator to the serverStatus command - it is just an estimate, but it can be used as a guide and to check if the other figures and estimates above make sense for you MongoDB instance.

share|improve this answer
Actually I am using MMS already, but I am not sure what figure to look at. – Howard Sep 10 '12 at 16:44
Generally the resident figure on the memory graph is the most relevant here. It will grow over time and occupy all available RAM (with older data paged out as needed for new data to be paged in) if your data set is significantly larger than RAM. If not and the data set is fairly static, it will find a lower level and hover there. The Max value I outline above would be the most RAM an individual database would take up as part of that figure. – Adam C Sep 10 '12 at 16:53

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.