4

I know I can set -dbcache=<MB> when starting bitcoind.
Does this effect how much RAM is allocated for the UTXOPool or UTXOPool + mempool?
How can I know how much RAM each database takes?

If the UTXO pool is 2.7GB, and I set -dbcache=4096, what happens to the rest of the allocated memory?

1 Answer 1

4

In Bitcoin Core, there are two settings, -dbcache and -maxmempool, defaulting to 450 and 300, respectively.

The mempool can only occupy as much as is configured through -maxmempool.

The UTXO set cache can occupy as much as is configured through -dbcache plus the amount of configured mempool space that is currently unused. The memory usage is however much higher than the equivalent representation on disk - loading the entire UTXO set would require 6-7 GiB at the time of speaking.

The in-memory representations are always larger. On disk they're just packed sequences of bytes. In memory, there are indexes and pointers, and memory allocation overhead - all to speed up access. The blowup factor for UTXO data is larger than for memory.

Since 0.14, the mempool is also saved to disk at shutdown (but not continuously).

So far, there is no prioritization done on the UTXO cache. We just keep all accessed entries around, and when it grows too large, all the modified entries are written to disk. One (very) significant optimization is that when a UTXO is created and then spent, without being written to disk in between, we just remove it from memory.

2
  • Thanks. So last question. If I use -dbcache=16384 will 16GB of my RAM be used regardless of the actual size the UTXO set will take up in RAM?
    – amanusk
    Commented Oct 14, 2017 at 17:19
  • No, only as much as can be used. Commented Oct 14, 2017 at 17:38

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.