Adding an index to a large collection; using gobs of memory

4 views
Skip to first unread message

Ask Bjørn Hansen

unread,
Nov 25, 2009, 2:48:11 PM11/25/09
to mongodb-user
Hi,

I have a sharded collection[1] with some tens of millions of rows
(about 75 I think). I wanted to add an index to make some queries go
faster. It finished quickly on the shard with less data; but the
shard that seems to have most of the data is taking a while (which is
fine); so far the _tmp directory is ~3.5GB (also fine); and mongod is
using 32GB memory, 18GB resident (not fine). 17G are marked 'shared'
so I am guessing that's mmap'ed data? Is this to be expected?

What would have happened if I had less memory in the box? Is there a
setting so I could tell it to only use 10GB memory (or whatever); not
counting mmap'ed data.

The box is also running other services so eating all the memory isn't
fun -- and we're planning to add 10-20x more data so I'm concerned how
that'd play.


- ask

[1] Same lopsided one I just posted about.

Eliot Horowitz

unread,
Nov 25, 2009, 2:50:02 PM11/25/09
to mongod...@googlegroups.com
That's mmaped data - so you don't need real RAM or even virtual ram to
back it up.
It uses almost nothing that isn't mmaped, so there isn't a setting.
> --
>
> 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.
>
>
>

Ask Bjørn Hansen

unread,
Nov 26, 2009, 3:02:53 AM11/26/09
to mongod...@googlegroups.com

On Nov 25, 2009, at 11:50, Eliot Horowitz wrote:

> That's mmaped data - so you don't need real RAM or even virtual ram to
> back it up.
> It uses almost nothing that isn't mmaped, so there isn't a setting.


Maybe I just don't understand how it works then; but the end-result for me is that top reports mongod to use 32GB memory; of which 15-16GB is reported resident.

You are saying that all that memory is just mmap'ed data? I guess that's okay then, except Linux does seem to favor using memory on that mmap'ed data over using it for file system cache (which I'm using for MyISAM tables on this particular set of boxes).


- ask


# ps axwum | grep mongod | head -1
root 4051 35.7 48.3 33139564 15940924 ? - Nov24 640:42 /pkg/packages/mongodb-linux-x86_64-2009-11-24/bin/mongod --shardsvr --dbpath=/mongodb/shard/

# top -n 1
Tasks: 208 total, 1 running, 207 sleeping, 0 stopped, 0 zombie
Cpu(s): 7.5%us, 0.5%sy, 0.0%ni, 87.4%id, 4.4%wa, 0.0%hi, 0.1%si, 0.0%st
Mem: 32962968k total, 32800712k used, 162256k free, 120516k buffers
Swap: 2097144k total, 2097036k used, 108k free, 20186236k cached

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
3951 mysql 15 0 10.8g 9.1g 3480 S 124.4 28.8 9104:14 mysqld
4051 root 16 0 31.6g 15g 15g S 71.1 48.3 642:38.92 mongod
[...]

Dwight Merriman

unread,
Nov 26, 2009, 5:28:05 PM11/26/09
to mongod...@googlegroups.com
right
Reply all
Reply to author
Forward
0 new messages