Please describe the feature you’d like to see added.
Better default settings, or fix to database cache handling
Is your feature related to a problem, if so please describe it.
When doing IBD using default settings, on a relatively fast machine on relatively fast HDD everything works well until ~when segwit was activated. After that ETA estimate shot up from 4 days to 3 weeks. Investigating, my 1MB/s internet was downloading only about 15% of the time. The operating system became extremely laggy, and i found that the HDD was stuck on 100% IO load, doing 4-6MB/s read, plus the normal occasional writes for downloaded parts.
I tried increasing db cache by 2x to 900MB, but absolutely nothing changed. RAM usage etc. same.
Searching for issues i found that many “fixed” it by putting chainstate on SSD. This was not an option, so i started looking into putting it into a ramdrive. But then in a random comment about using a ramdrive someone said using more than 8000 dbcache makes the full chainstate fit into ram, essentially achieving the same. I was skeptical, since doubling it had not made any difference. But i decided to test it with 8500.
And Bitcoin started working perfectly. Continuous download, low IO load, much faster write throughput. Something bordering unusable became smooth. So why is this a feature request instead of “that’s expected with such high db cache”
Because even a device with only 3 gigs of ram can use a value of 8500 and start working well, instead of being useless. It takes something like 8 hours before bitcoin’s RAM usage reaches 3 gigs when syncing at 1MB/s. And at this point one can restart bitcoin which frees the ram, and sync for another 8 hours.
This is very weird that there exists an undocumented “threshold” where dbcache’s operation changes completely, starting to work as an actual cache, freeing the HDD from doing constant small random read operations.
Describe the solution you’d like
just drop dbcache setting completely, let it grow as needed and when RAM starts to get full, just flush it as if restarting bitcoin. I wonder how many HDD:s have broken down due to weeks long constant 100% random read IO stress due to this issue, and how many users gave up on the idea of running a node because they thought their machine is not up to the task.
Describe any alternatives you’ve considered
change default setting to the minimum value that can support proper cache behavior after segwit blocks. Warn user that reducing the cache will cause extreme slowdown and disk stress when doing IBD after segwit blocks start, practically only doable with SSD.