With 35 connections, my bitcoind consumes 581Mb of memory which is over half of my total memory in VPS (1024 total) and I need memory also for other services such as apache2 and mysql on my server. Can I take any steps to limit the resources used by bitcoind to about a nice round number 256Mb without severely limiting the bitcoind's ability to function properly? I suppose I can limit the number of max inbound/outbound connections in bitcoin.conf, but then what would be a good limit?
migrated from serverfault.com Aug 14 '11 at 13:19
This question came from our site for professional system and network administrators.
I think softlimit as a wrapper program is what you need to use. I don't know without testing whether that will force swapping or just kill it.
bitcoind uses a ton of memory while it's downloading the blockchain. Check out these steps on how to set up your swap space correctly on Ubuntu:
Additionally, you can check out the torrent download of the blockchain. As long as you trust the file, this can help speed up the time to download the blockchain.
You can tweak mysql and apache to use work with much less ram than their defaults, this is a different subject though and obviously it may not be an option (based) on the volume of your traffic etc...
Its interesting that its connected to so many nodes, on default it only does about 8 connections last time I looked
I'd suggest adding this to your ~/.bitcoin/bitcoin.conf to at least limit the sessions for now:
(use more if you want to sync the entire blockchain (from scratch) faster, then reduce it afterwards although I'm uncertain how/if this will effect its footprint.)
I've got version 80600 running at the moment, 8 connections and its running (RSS) around 320M
I think bitcoind will always need a big chunk amount or ram though... (https://github.com/bitcoin/bitcoin/issues/2485)...
I'd be interested to see what can be learned about reducing its memory footprint. I will start research this myself. ( I'm running well over 10 coins on a server I host and just had to bump its ram to 4g as it was swapping all over the place, so it would be good to know )
For the moment I suggest a few tweaks to mysqld and apache. There is a vast array of options.. For mysqld checkout mysqltuner.pl and start bumping numbers (plenty of tutorials out there for this but I suggest small changes at a time)
..this is from a reasonably small mysqld I run on one of my VMs (debian 6), its around 128Mb in footprint right now (but could potentially go up to 164Mb)..
^^ (If mysqld can run on a raspberry pi this can be even reduced much further)
...if you're having stability issues I'd suggest at least creating a swapfile and activate it.
Swapfiles may not be option depending on the virtualization used but its better than things crashing I assume.