banner

Only deserialized UTXOs are held in the dbcache. Deserialized UTXOs are larger than the serialized representation on disk, so even while the chainstate is only 11 GB, it would be larger in memory.

The -maxmempool configuration parameter limits the amount of memory used by the mempool in MB. Unused mempool memory is used as additional dbcache.

Old blocks are only stored on disk, they are not cached.

That said, there might be a misunderstanding here:
The UTXO set is primarily stored on disk. When a node processes unconfirmed or confirmed transactions, it will load all the necessary UTXOs for inputs from disk into the cache. When a new block is processed, it will also cache any outputs created by the confirmed transactions in the block.

The UTXO cache acts as a write-buffer. The UTXO set changes are kept in memory until the dbcache is full and then the entire cache is flushed to disk (emptying the cache). If a UTXO is created and spent before the cache is flushed, it is never written to disk. The UTXO state is also synchronized to disk once per day (once per hour during IBD) even if the dbcache is not full. Then only the dirty entries are written to disk and the remaining cache is kept warm (not emptying the cache).

Nodes do not reload the entire UTXO cache when starting. UTXOs only get cached due to transactions being validated, so except right after IBD with a very large dbcache, a node will generally never hold the entire UTXO set in memory. The node will however only allocate as much memory as it uses, so a larger than necessary dbcache will not waste memory. A larger dbcache is predominantly useful during IBD, and it is not necessary for the dbcache to be large enough to hold the entire UTXO set. Since a node also needs memory for the operating system and other programs, the dbcache setting should not be set higher than 75% of the node’s available memory.

I assume that all of this will be the same for Knots, but I am not familiar with that code base.

banner

Converter

Source: CurrencyRate
Top Selling Multipurpose WP Theme

Newsletter

banner

Leave a Comment