[mongodb-user] mongodb running out of memory - uncaught exception std::bad_alloc

781 views
Skip to first unread message

Zac Witte

unread,
May 2, 2010, 2:31:22 PM5/2/10
to mongodb-user
I'm trying to run mongodb on a VPS with 512MB of memory and no swap
volume. My database is about 2.5GB and mongod keeps running out of
memory which causes an std::bad_alloc uncaught exception to be thrown.
That causes the server to fault and my database to be corrupted. I
can't even run a repair operation because it requires too much memory.
There has to be some way of running a DB bigger than the available
memory. How are other people doing this?

Zac

--
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.

Dwight Merriman

unread,
May 2, 2010, 3:17:38 PM5/2/10
to mongod...@googlegroups.com
32 bit or 64 bit OS?

mongo uses memory mapped files your db can't be bigger than 2 gig on 32 bit build.

Zac Witte

unread,
May 3, 2010, 1:07:48 AM5/3/10
to mongodb-user
It's a 64bit mediatemple (ve) instance running ubuntu server 9.10.
http://mediatemple.net/webhosting/ve/

root@ve:/var/www# uname -m
x86_64
root@ve:/var/www# uname -a
Linux ve.mxv27d5r.vesrv.com 2.6.18-028stab068.9 #1 SMP Tue Mar 30
17:22:31 MSD 2010 x86_64 GNU/Linux

On May 2, 12:17 pm, Dwight Merriman <dwi...@10gen.com> wrote:
> 32 bit or 64 bit OS?
>
> mongo uses memory mapped files your db can't be bigger than 2 gig on 32 bit
> build.
>
>
>
> On Sun, May 2, 2010 at 2:31 PM, Zac Witte <zacwi...@gmail.com> wrote:
> > I'm trying to run mongodb on a VPS with 512MB of memory and no swap
> > volume. My database is about 2.5GB and mongod keeps running out of
> > memory which causes an std::bad_alloc uncaught exception to be thrown.
> > That causes the server to fault and my database to be corrupted. I
> > can't even run a repair operation because it requires too much memory.
> > There has to be some way of running a DB bigger than the available
> > memory. How are other people doing this?
>
> > Zac
>
> > --
> > 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<mongodb-user%2Bunsu...@googlegroups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/mongodb-user?hl=en.
>
> --
> 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 athttp://groups.google.com/group/mongodb-user?hl=en.

Eliot Horowitz

unread,
May 3, 2010, 8:32:22 AM5/3/10
to mongod...@googlegroups.com
Can you send the output of (u)limit -a

Zac Witte

unread,
May 3, 2010, 1:43:13 PM5/3/10
to mongod...@googlegroups.com
Sure, here it is.

root@ve:~# ulimit -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 20
file size               (blocks, -f) unlimited
pending signals                 (-i) 16382
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
open files                      (-n) 1024
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) unlimited
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

Eliot Horowitz

unread,
May 3, 2010, 1:54:41 PM5/3/10
to mongod...@googlegroups.com
how much swap space do you have?
can you write a tiny app to malloc more than 2gb?

Zac Witte

unread,
May 3, 2010, 2:02:13 PM5/3/10
to mongod...@googlegroups.com
There's no swap volume on this VPS. I heard mongo isn't supposed to use swap anyway?

I could write a little app later tonight perhaps. I'm almost certain it won't allow me to malloc more than the amount of RAM in the system.

Zac

Eliot Horowitz

unread,
May 3, 2010, 2:04:01 PM5/3/10
to mongod...@googlegroups.com
Ok, can you do a db.serverStatus()

The server does need some regular heap space, so its possible 512
isn't enough with other things running as well.
Reply all
Reply to author
Forward
0 new messages