btcd icon indicating copy to clipboard operation
btcd copied to clipboard

blockchain: increase periodic flush interval

Open kcalvinalvin opened this issue 1 year ago • 2 comments

The periodic flush intervals were set to 5 minutes previously which on average means that the node will flush every block when the node is caught up to the tip.

This put an overhead on the node after the node is caught up beyond the last checkpointed block as it'll start calling the periodic flush function. So while the node is still performing ibd, it'll be flushing every 5 minutes, hurting performance.

Changing this value to 48 hours doesn't hurt the node too much as the average worst case would be 288 blocks to reindex which is quick. For a decent computer, 48 hours should be enough time to sync all the blocks beyond the last checkpointed block as well. If not, 1-2 flushes don't hurt as much as flushing every 5 minutes.

kcalvinalvin avatar Jul 17 '24 05:07 kcalvinalvin

Pull Request Test Coverage Report for Build 9968910112

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.004%) to 57.221%

Totals Coverage Status
Change from base Build 9957391466: 0.004%
Covered Lines: 29834
Relevant Lines: 52138

💛 - Coveralls

coveralls avatar Jul 17 '24 05:07 coveralls

IIUC, with this most syncs wouldn't ever sync the utxo set cache until the very end (at least on a fast computer, possibly syncing over LAN). Let's say it crashes right before sync finishes, well before the 48 hour mark, how long would it take to reconstruct/reconcile the UTXO set cache on start up?

Roasbeef avatar Jul 23 '24 22:07 Roasbeef