Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm not expert in mongo memory management but some things confuse me. I use Mongo 2.4.9 and I have a replica sets for three nodes. I have performed db.serverStatus().mem and see that size of mapped is very high, 47GB:

db.serverStatus().mem
{
        "bits" : 64,
        "resident" : 266,
        "virtual" : 101491,
        "supported" : true,
        "mapped" : 47402,
        "mappedWithJournal" : 65730
}

Result of db.stats(1024)

{
        "db" : "xxxxx",
        "collections" : 7,
        "objects" : 670488,
        "avgObjSize" : 2890.6140721385023,
        "dataSize" : 1892697,
        "storageSize" : 2273304,
        "numExtents" : 49,
        "indexes" : 42,
        "indexSize" : 399378,
        "fileSize" : 10416128,
        "nsSizeMB" : 16,
        "dataFileVersion" : {
                "major" : 4,
                "minor" : 5
        },
        "ok" : 1
}

In megabytes

"dataSize" : 1848mb
"storageSize" : 2220mb
"fileSize" : 10172mb

WorkingSet info:

"workingSet" : {
         "note" : "thisIsAnEstimate",
         "pagesInMemory" : 152599,
         "computationTimeMicros" : 31143,
         "overSeconds" : 1728
 }

Size(Mb) = 152599*4kb -> convert to Mb = 596 Mb

My question is why the size of mapped memory is 4,2 times greater than fileSize and 15159 times greater than the storageSize or dataSize ? Mapped memory memory continues to grow slowly. About two weeks ago it was about 32gb.

Note:

OS: Red Hat Enterprise Linux Server release 5.7 (Tikanga)
Physical memory: 3892Mb

I read this article but still don't understand why the size of mapped memory so large taking into account the enough small size of real data (filesize).

Thanks.

share|improve this question

1 Answer 1

up vote 0 down vote accepted

The mapped figure you list from the db.serverStatus() output is basically a measurement of all data files that have been mapped into memory using mmap. The subsequent commands you list are either for a single database (db.stats()) and that is not going to be equivalent for all databases unless you run it on all databases and add the figures together. Or, they measure something completely different (working set) which will be very dependent on what you have been doing with the database recently, and will not exceed your physical memory.

Regarding the databases, no replica set is only one database, there is always the local DB, which contains the oplog for replication and that (at a minimum) will be included in the mapped figure, as will any empty space used for pre-allocation.

You should find that the mapped figure lines up pretty well with the actual size of the data files in you dbpath. If the database is running, then the journal will be present also, and including the journal folder will get you the mappedWithJournal figure (if the database is shutdown cleanly, the journal files are removed and reallocated again at start up).

share|improve this answer

Your Answer

 
discard

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.