writes
Posts on how Cinder writes blocks to disk: writes in the background, the blocks that wait in memory and the cost of each write.
- A 10 ms wait that did its job and still lost: why we rejected itAt persist depth 0, the writer often computes a state root over its batch. The reason: the trie-node job of the newest block still runs at the hand-over. A bounded wait of at most 10 ms removed that fallback. About 1 100 batches per run went to about 19. But newPayload and the writer were slower in 4 of 5 rounds, and there was no gain. The interval over blocks said that the cost was certain. The A/A control said that this interval was too narrow. We rejected the change, and here is the data.
- Compressed block bodies: about half the disk, and an estimate that was wrong by a factor of twoA full Cinder node kept each block body after the merge as it was: about 1 407 GB on mainnet. Our design estimate was 600 to 700 GB. Now each body is one zstd frame. The body table takes 0.481 of its pages for blocks across the eras after the merge, and 0.366 for recent blocks. That gives about 648 to 677 GB. The writer pays about 0.5 ms of CPU per recent block, and a read about 90 µs. A replay with an A/A control shows no newPayload effect larger than its noise band of about 0.3 to 0.5 ms.
- Sync from genesis: 256 blocks per write, 40 times fewer fsync calls, and a prewarm result we could not claimThree speed items for the sync from genesis, measured on 3 000 Hoodi blocks with an A/A control. Write batches of 256 blocks made the execution stage about 38% faster and wrote 37% fewer pages. Lazy commits cut the fsync calls from 716 to 18. But on a fast disk, the time gain was inside the A/A spread. A second write of each body costs nothing, so we wrote no code for it. And the prewarm: off, the mean was 13.8% slower, but the interval went from -7.8% to +44.1%.
- A state root on a parent that is not on disk yetWhen blocks are written in the background, the next block often arrives before its parent is on disk. Keeping each block's new trie nodes in memory made catching up 1.8 times faster.
- The write that our latency windows did not showCinder answered engine_newPayload in 97 ms and still fell 400 blocks behind. Moving block writes to a background thread, and the reorg bug that came with it.