,ggg, ,ggg,_,ggg,                        ,ggg,
             ,dPYb,            dP""Y8dP""Y88P""Y8b                      dP""8I           8I
             IP'`Yb            Yb, `88'  `88'  `88                     dP   88           8I
             I8  8I             `"  88    88    88                    dP    88           8I                      gg
             I8  8'                 88    88    88                   ,8'    88           8I                      ""
 gg,gggg,    I8 dPgg,   gg,gggg,    88    88    88    ,ggggg,        d88888888     ,gggg,8I   ,ggg,,ggg,,ggg,    gg    ,ggg,,ggg,
 I8P"  "Yb   I8dP" "8I  I8P"  "Yb   88    88    88   dP"  "Y8       ,8"     88    dP"  "Y8I  ,8" "8P" "8P" "8,   88   ,8" "8P" "8,
 I8'    ,8i  I8P    I8  I8'    ,8i  88    88    88  i8'    ,8 dP   ,8P      Y8   i8'    ,8I  I8   8I   8I   8I   88   I8   8I   8I
,I8 _  ,d8' ,d8     I8,,I8 _  ,d8'  88    88    Y8,,d8,   ,d8 Yb,_,dP       `8b,,d8,   ,d8b,,dP   8I   8I   Yb,_,88,_,dP   8I   Yb,
PI8 YY88888P88P     `Y8PI8 YY88     88    88    `Y8P"Y8888P"   "Y8P"         `Y8P"Y8888P"`Y88P'   8I   8I   `Y88P""Y88P'   8I   `Y8
 I8                     I8
 I8                     I8
 I8                     I8
 I8                     I8
 I8                     I8
 I8                     I8

MongoDB In-Memory Database

This will build a database of Heap Memory Tables

Be sure to have at least 512mb of ram before attempting this!

Run the MongoDB database inside a mounted RAM disk - 256mb in this example

vi /etc/init.d/ramdb

case "$1" in
/bin/mount -t tmpfs none /ramdb -o size=256m
/data/mongod --fork --quiet --dbpath /ramdb --nssize=2 --smallfiles --noprealloc > /dev/null
exit 1;
pkill mongod # Note: some Linux distros use killall instead of pkill
/bin/umount /ramdb
exit 1;

mkdir /ramdb
chmod -R 755 /ramdb

chmod 755 /etc/init.d/ramdb

Start Mongo so that it operates in RAM space

/etc/init.d/ramdb start

Set to start automatically upon bootup - note update-rc.d is not on all Linux distros, you may need to do this differently

update-rc.d ramdb defaults 99

If you already have an instance of Mongo running then you will need to change the port for one of the instances, add the switch to the mongod start-command above:


Powered by Avinu