Hi Kevin and Nick
I'm currently experiencing the same kind of issue on linux with mongo 3.4.1
We use mongoDB for our internal monitoring system and we are currently
doing some experimentation about redesigning the schema to improve our
So I have 2 servers :
- The development server (mongo 3.6.1) which runs perfectly : it hosts a
dump of the production database (16GB), a copy of this dump using our new
schema (6GB) and a stress test database (300GB). It is started with a WT
cache size of 2GB, and even when doing massive insertions on the stress
test DB (on 50 connections), the resident set size (as reported by the
"top" command) stay only slightly above the cache size, somewhere between
2.3 and 2.5GB. This server runs on CentOS 6, without any
- The production server (mongo 3.4.1) which experiences excessive memory
consumption and crashes : it host the production database. It is running in
an OpenVZ container (on top of CentOS 6, without cap on privvmpages so
there shouldn't be any issue like the one that occured with older versions
of OpenVZ). The whole container has 5GB of RAM available, and WT cache size
is 2GB too (confirmed by executing db.serverStatus().wiredTiger.cache on
the prod environment) . However, we always have a bigger resident set side
for the mongod process, often greater than 4GB. This lead to have the mongo
instance performs really poorly (since swap start to be used) and
eventually the kernel OOM killer kicks in when the container dedicated RAM
is full. This occurs several times per week
For the access patterns : our applications periodically push some new
documents in the DB, but there are very few query/aggregations running,
since they are very few (< 5) users that are getting data from the DB, and
they only do it occasionally, most of the time there is no query at all.
So I would like to know :
- Is there any major memory leak that have been fixed between 3.4 and 3.6
that can explain this ?
- How can I investigate on the cause of this memory consumption ?
Post by Nick Judson
Hi Kevin - thanks for replying.
You are correct that I am referring to the --wiredTigerCacheSizeGB (set to
1). I was sent a screenshot of task manager showing the mongo db process
using >3GB of memory, as well as the metrics files (which I cannot open). I
am aware of all of the settings and potential overages for MongoDB/WT, and
it is entirely possible that there is some edge-case workload going on here
which is causing MongoDB to bump up to 3x the wiredTigerCacheSizeGB
setting. This does seem unlikely though as I have never encountered it
before (in many other installations). In the past I would have posted this
on the MongoDB JIRA page and the contents of the metrics file would be
exploded into those nice graphs which show exactly what is occurring. I
suppose I'm asking if it's possible for someone to do the same via this
forum? I could PM the metrics files and then someone internal to MongoDB
could post the resulting graph/prognosis.
Post by 'Kevin Adistambha' via mongodb-user
Could you elaborate on how you determine that MongoDB is using >3 GB?
Note that by âcache sizeâ Iâm assuming you meant the WiredTiger cache size
Please note that WiredTiger cache size setting governs only the maximum
cache size of WiredTiger, and not the overall MongoDB memory use. Other
processes such as client connection, aggregation framework, queries, etc.
uses memory on top of WiredTiger cache usage. Therefore, a busy server
could use significantly more memory on top of the WiredTiger cache size
Having said that, as of MongoDB 3.6.2, there is currently no built-in
method to limit MongoDB memory usage, since MongoDB was designed to utilize
as much memory as possible to give you the best performance.
For diagnosing memory usage, you may be able to use Memory Diagnostics
for the WiredTiger Storage Engine
as a starting point.
You received this message because you are subscribed to the Google Groups "mongodb-user"
For other MongoDB technical support options, see: https://docs.mongodb.com/manual/support/
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to email@example.com.
To post to this group, send email to firstname.lastname@example.org.
Visit this group at https://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/5f4506c0-2d9d-4972-8ab2-259adbae2356%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.