Help me understand virtual vs. resident memory

1,070 views
Skip to first unread message

james

unread,
Feb 6, 2011, 5:51:06 PM2/6/11
to mongodb-user
We are consistently getting memory stats from mongo that look like
this (we're on 1.6.1):

resident: X
mapped and virtual: Y

... where Y is a good deal larger than X and when we have way more
than X of physical RAM available for mongo to use.

Here's a concrete example:

resident: 3GB
mapped : 9GB

On a machine with 7.5GB RAM.

Basically it looks like mongo would like to use 9GB of RAM but is only
taking 3GB. The only explanation we could think of (and have seen in
the forums) is that other processes on the machine are taking away RAM
from mongo, but in our case we can't account for the unused RAM. Just
seems like mongo is not using as much RAM as it could.

Are we missing something?

Thanks!

Scott Hernandez

unread,
Feb 6, 2011, 6:06:31 PM2/6/11
to mongod...@googlegroups.com
http://www.mongodb.org/display/DOCS/Checking+Server+Memory+Usage

> --
> You received this message because you are subscribed to the Google Groups "mongodb-user" group.
> To post to this group, send email to mongod...@googlegroups.com.
> To unsubscribe from this group, send email to mongodb-user...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/mongodb-user?hl=en.
>
>

Eliot Horowitz

unread,
Feb 6, 2011, 6:07:33 PM2/6/11
to mongod...@googlegroups.com
Assuming nothing else is using the ram, there is a number of reasons
mongo won't be using it:
- mongo was restarted at some point and its only ever needed 3gb of data
- os decided some pages were access in so long its taking them away
- memory contention at some point pushed out old pages, and mongo
hasn't needed them

I would only worry about a situation like this if mongo is also
reading from disk a lot.
If there is no disk reading happening, its a non-issue.
If mongo is having to read from disk a lot (iostat) then something
weird is going on.

-Eliot

Jean Carlo

unread,
Jun 12, 2013, 6:22:29 PM6/12/13
to mongod...@googlegroups.com
HI eliot.

If my case is mongo "is having to read from disk a lot (iostat)"

What iostat should show to know that?


this is an output

Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util
xvdb              0.00     0.00   11.00    9.00   256.00   128.00    38.40     0.02    0.80    1.09    0.44   0.60   1.20

Asya Kamsky

unread,
Jun 12, 2013, 10:48:57 PM6/12/13
to mongod...@googlegroups.com
Please start a new thread with your question rather than responding to a thread that's more than two years old.

Chalie Chan

unread,
Nov 14, 2013, 3:27:40 PM11/14/13
to mongod...@googlegroups.com
sorry, for picking on this old thread, can anyone point me to any new related thread. As I can see same happening with one of my Mongo deployments. In one env, MongoD is able to use up to 10GB whereas on another server, it never goes up after 2-3GB max.

Asya Kamsky

unread,
Nov 17, 2013, 4:51:55 PM11/17/13
to mongodb-user
The most obvious things to check would be the differences between servers (and their usage).

First, is the load the same?  (If you don't query more than 2GB of data, only 2GB of data would show up resident)
Is disk configuration the same?  (readahead in particular)
Are there other processes on the servers?  (Memory used by other processes isn't available to the file cache and therefore 'mongod').

Asya



--
--
You received this message because you are subscribed to the Google
Groups "mongodb-user" group.
To post to this group, send email to mongod...@googlegroups.com
To unsubscribe from this group, send email to
mongodb-user...@googlegroups.com
See also the IRC channel -- freenode.net#mongodb
 
---
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 mongodb-user...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply all
Reply to author
Forward
0 new messages