How to run bitcoind in a low memory environment

9

3

I have a Raspberry Pi with 925 MB of memory. Bitcoin Core, operating as a full node, uses between 600-900 MB. How can I reduce bitcoind's memory usage?

I tried setting maxmempool to its minimum allowed value, 5. What about maxreceivebuffer and maxsendbuffer? Would setting these to a low value reduce memory usage?

Geremia

Posted 2017-01-05T15:26:29.583

Reputation: 3 665

2Short comment before writing a full answer: a 5 MB mempool isn't particularly useful. You might as well disable the mempool entirely with -blocksonly.Pieter Wuille 2017-01-06T00:26:00.077

@PieterWuille That's a good suggestion. I didn't know about that option. It probably lowers memory usage, too. In fact, this Reddit post on running a node on a 512 MB Raspberry Pi mentions using that flag, too.

Geremia 2017-01-06T00:50:36.867

With -blocksonly you don't have any mempool at all.Pieter Wuille 2017-01-10T02:10:46.373

Answers

13

The largest consumers of memory are:

  • The memory pool (reduce with -maxmempool, or disable entirely with -blocksonly if you don't care about unconfirmed transactions).
  • The UTXO cache (reduce with -dbcache, at the cost of potentially much slower syncing).
  • The signature cache (reduce with -maxsigcachesize).

In addition, you can also reduce the maximum number of connections (-maxconnections) or the number of RPC threads (-rpcthreads).

A viable minimum configuration without mempool could be -blocksonly -dbcache=20 -maxsigcachesize=4 -maxconnections=4 -rpcthreads=1.

Pieter Wuille

Posted 2017-01-05T15:26:29.583

Reputation: 54 032

-blocksonly alone brought my node's memory footprint down to about ~700 MB. I also have -banscore set to 1, which seems to help get rid of spammy nodes that flood my node with bad transactions.Geremia 2017-01-12T15:04:36.533

Was still crashing with me! But setting also maxmempool=100 was causing bitcoind to be at ca. 570MB RSS, that works on my 1GB VPS.Borph 2017-03-20T08:48:43.410

2I used the follow options: blocksonly=1 dbcache=50 maxorphantx=10 maxmempool=100 maxconnections=32 and bitcoind is running smoothly on my raspberrypi with the follow Memory footprint VSZ 422524 and RSZ 266956Alex 2017-09-04T19:39:44.490

1

Followed your parameter:

bitcoind -blocksonly=1 -dbcache=50 -maxorphantx=10 -maxmempool=100 & 

Now I have only 286M memory used with bitcoind running.

Makarthur

Posted 2017-01-05T15:26:29.583

Reputation: 11

1

Please don't use the "answer" box to write "thank you" type comments. Please take the [tour] and check this faq on deleted answers.

Max Vernon 2018-09-21T19:29:10.327

1In my opinion this answer does add a bit more new information so I don't think it needs to be deletedMeshCollider 2018-09-23T12:55:06.777