I’m running libbitcoin’s bitcoin-server on a VPS with 1 GB of RAM and 512 MB of swap, which is clearly not enough. The server starts getting killed for reaching an out-of-memory condition every minute or so after block #200000, even on Testnet.

It’s dirty and it clogs up fast, but it works.

Every OOM kill adds to the possibility of database corruption. So I sometimes back it up, too.

/home/veox/bin/run-bs:

#!/bin/sh
# bitcoin-server launch wrapper
# restarts the server if it gets OOM-killed

while true; do
    if [ "x`pidof bs`" = "x" ]; then
        cd /home/veox/testnet
        /usr/sbin/logrotate -s ./bs.logrotate.status ./bs.logrotate
        /home/veox/usr/bin/bs /home/veox/usr/etc/libbitcoin/bs.cfg
    fi
    sleep 10
done

/home/veox/testnet/bs.logrotate:

/home/veox/testnet/error.log /home/veox/testnet/debug.log {
    size 1M
    missingok
    notifempty
    rotate 21
}

/home/veox/testnet/bs.logrotate.status:

"/home/veox/testnet/error.log" 2015-5-24-21:22:55
"/home/veox/testnet/debug.log" 2015-5-24-21:22:55