The Performance Tuning: LevelDB write buffers and compaction
The Performance Tuning: LevelDB write buffers and compaction
In our next 1,500 words, we look at the Optimization of the Disk. How do you make your node process 10,000 transactions per second? You tune the LevelDB Internal Settings.
1. The -dbcache Allocation
This is the "Working RAM" of your database.
-
90% of this cache is given to the Coins View.
-
When you increase
-dbcache, you are allowing the node to keep more of the "Live" coins in memory. -
This eliminates the need for slow "Disk Reads" during block validation. It is the Power of the Sovereign.
2. The Write Buffer (Memtable)
LevelDB uses a "Write Buffer" to group changes.
-
Instead of writing 1 coin at a time, it waits until the buffer is 64MB or 128MB.
-
It then writes the entire block in one "Sequential Burst."
-
This is why SSDs are so much faster than HDDs for Bitcoin—they can handle these bursts with zero "Seek Time." It is the Performance of the Machine.
3. The Compaction Triggers
When LevelDB has too many small files, it "Merged" them.
-
This is called Compaction.
-
It is a CPU and Disk-intensive task.
-
By tuning the "Level" sizes, the node can ensure that compaction doesn't slow down the network during busy times. It is the Metabolism of the Protocol.
TeachMeBitcoin is an ad-free, open-source educational repository curated by a passionate team of Bitcoin researchers and educators for public benefit. If you found our articles helpful, please consider supporting our hosting and ongoing content updates with a clean donation: