Friday, January 9, 2026
HomeBitcoinbitcoin core - What's saved in dbcache and with what precedence?

bitcoin core – What’s saved in dbcache and with what precedence?

Solely deserialized UTXOs are held within the dbcache. Deserialized UTXOs are bigger than the serialized illustration on disk, so even whereas the chainstate is barely 11 GB, it could be bigger in reminiscence.

The -maxmempool configuration parameter limits the quantity of reminiscence utilized by the mempool in MB. Unused mempool reminiscence is used as further dbcache.

Outdated blocks are solely saved on disk, they don’t seem to be cached.

That mentioned, there may be a misunderstanding right here:
The UTXO set is primarily saved on disk. When a node processes unconfirmed or confirmed transactions, it is going to load all the required UTXOs for inputs from disk into the cache. When a brand new block is processed, it is going to additionally cache any outputs created by the confirmed transactions within the block.

The UTXO cache acts as a write-buffer. The UTXO set modifications are saved in reminiscence till the dbcache is full after which your complete cache is flushed to disk (emptying the cache). If a UTXO is created and spent earlier than the cache is flushed, it’s by no means written to disk. The UTXO state can also be synchronized to disk as soon as per day (as soon as per hour throughout IBD) even when the dbcache isn’t full. Then solely the soiled entries are written to disk and the remaining cache is saved heat (not emptying the cache).

Nodes don’t reload your complete UTXO cache when beginning. UTXOs solely get cached because of transactions being validated, so besides proper after IBD with a really massive dbcache, a node will usually by no means maintain your complete UTXO set in reminiscence. The node will nevertheless solely allocate as a lot reminiscence because it makes use of, so a bigger than vital dbcache is not going to waste reminiscence. A bigger dbcache is predominantly helpful throughout IBD, and it’s not vital for the dbcache to be massive sufficient to carry your complete UTXO set. Since a node additionally wants reminiscence for the working system and different packages, the dbcache setting shouldn’t be set increased than 75% of the node’s out there reminiscence.

I assume that every one of this would be the identical for Knots, however I’m not aware of that code base.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments