Reputation: 1413
Can somebody tell me why Mongo doesn't consume more than ~300-400MB of memory when there's 2GB available and dataSize is about 4GB currently with a bit under 5 million documents?
Even with queries that process A LOT of documents memory consumption doesn't spike. I've few other processes running on the same server but as I'm watching New Relic, memory consumption is never over 500MB.
Don't know if it matters in this case but the server is virtualised with KVM. We are using 64bit version so no 32bit limits.
edit cat /proc/meminfo
MemTotal: 2051488 kB
MemFree: 205420 kB
Buffers: 8472 kB
Cached: 1346496 kB
SwapCached: 43224 kB
Active: 1208548 kB
Inactive: 551952 kB
Active(anon): 162448 kB
Inactive(anon): 243196 kB
Active(file): 1046100 kB
Inactive(file): 308756 kB
Unevictable: 0 kB
Mlocked: 0 kB
SwapTotal: 4194300 kB
SwapFree: 4041128 kB
Dirty: 812 kB
Writeback: 0 kB
AnonPages: 397844 kB
Mapped: 222180 kB
Shmem: 72 kB
Slab: 40728 kB
SReclaimable: 28304 kB
SUnreclaim: 12424 kB
KernelStack: 1800 kB
PageTables: 13832 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 5220044 kB
Committed_AS: 1404372 kB
VmallocTotal: 34359738367 kB
VmallocUsed: 9888 kB
VmallocChunk: 34359728471 kB
HardwareCorrupted: 0 kB
AnonHugePages: 0 kB
HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 2048 kB
DirectMap4k: 53228 kB
DirectMap2M: 2043904 kB
Upvotes: 0
Views: 981
Reputation: 1554
If you run free -m
or cat /proc/meminfo
, you should be able to see the breakdown of memory usage.
Buffer relates to how much RAM is used to cache disk blocks. Cached is similar to buffers, except it's cached pages from reading files.
If these are high, it would indicate that your read-ahead settings are too large and MongoDB cannot use the remaining memory - degrading performance.
Upvotes: 1