16

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?

3
  • 2
    Short comment before writing a full answer: a 5 MB mempool isn't particularly useful. You might as well disable the mempool entirely with -blocksonly. Commented Jan 6, 2017 at 0:26
  • @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
    Commented Jan 6, 2017 at 0:50
  • With -blocksonly you don't have any mempool at all. Commented Jan 10, 2017 at 2:10

2 Answers 2

21

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.

Some advice is also included in the documentation under https://github.com/bitcoin/bitcoin/blob/master/doc/reduce-memory.md

5
  • -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
    Commented Jan 12, 2017 at 15:04
  • 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
    Commented Mar 20, 2017 at 8:48
  • 2
    I 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 266956
    – Zioalex
    Commented Sep 4, 2017 at 19:39
  • carefully set blocksonly=1,in my case when i set this parameter,the txid cant be added to mempool and stucked for a very long time.no errors in log.
    – nervalpoet
    Commented May 13, 2022 at 2:15
  • Some more details available at: github.com/bitcoin/bitcoin/blob/master/doc/reduce-memory.md Commented Jun 3, 2022 at 15:26
5

Followed your parameter:

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

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

3
  • 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.
    – Hannah Vernon
    Commented Sep 21, 2018 at 19:29
  • 1
    In my opinion this answer does add a bit more new information so I don't think it needs to be deleted Commented Sep 23, 2018 at 12:55
  • 3
    Why are you setting -maxmemool if you already have -blocksonly? Seems redundant to me but I might be missing something. Commented Jan 31, 2021 at 18:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.