HiveBrain v1.2.0
Get Started
← Back to all entries
patternMinor

mongodb memory leak or big collection?

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
mongodbcollectionbigleakmemory

Problem

mongo 2.4.6 x64

RAM 24 GB

With normal work memory consume around 10GB.

After that we started read data from db (create archive raw data) memory consuming up to 90% of all memory trough 5day. And go forfard by 0.1% by day. Is it normal situation and what happening when oom-killer come ?

mongotop
insert query update delete getmore command flushes mapped vsize res faults locked db idx miss % qr|qw ar|aw netIn netOut conn set repl time
0 0 0 0 0 2|0 0 21513g 43028g 1.49g 0 .:0.1% 0 0|0 0|0 190b 3k 31 replica PRI 02:25:08
0 0 0 0 0 1|0 0 21513g 43028g 1.49g 0 .:0.1% 0 0|0 0|0 62b 3k 31 replica PRI 02:25:09
0 0 0 0 0 2|0 0 21513g 43028g 1.49g 0 .:0.1% 0 0|0 0|0 190b 3k 31 replica PRI 02:25:10
0 0 0 0 0 1|0 0 21513g 43028g 1.49g 0 .:0.1% 0 0|0 0|0 62b 3k 31 replica PRI 02:25:11

free -m
total used free shared buffers cached
Mem: 24031 23835 195 0 33 1542
-/+ buffers/cache: 22259 1771
Swap: 511 4 507

Collection = 20TB

Solution

This has been asked and answered many times, so there is even a couple of FAQ sections on it. First you will need to understand the difference between resident memory usage and the cache being full (very different things), then you need to look at how memory mapped files behave in general. Here are a couple of starting points from the MongoDB Docs:

http://docs.mongodb.org/manual/faq/fundamentals/#does-mongodb-require-a-lot-of-ram
http://docs.mongodb.org/manual/faq/diagnostics/#memory-diagnostics

Short version, no it is not a memory leak, and yes it is expected behavior over time when the data set exceeds available physical memory.

Context

StackExchange Database Administrators Q#58928, answer score: 3

Revisions (0)

No revisions yet.