-
Notifications
You must be signed in to change notification settings - Fork 38.8k
Bump -dbcache default to 300MiB
#8273
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Specific numbers are of course open for discussion. |
|
Would this require mention in the release notes? Imagine someone updating on weak hardware, which does not support the new memory requirement. |
|
This is a good idea and we should def. do this! Long term I would wish a flexible solution. If you have to catch up a couple of days/week (or during IBD), bitcoind/qt should use a catchup-cache-setting (can be a different, second |
|
utACK fdf085f |
src/txdb.h
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: without knowing the shorthand by heart, it isn't exactly clear what << 20 represents here. It could have some implied context compared to the fact its just shorthand for MiB (assuming I've understood it correctly!)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, I don't want to mention numbers in the comments (as everyone forgets to update those as they're not checked by the compiler) but specifying that it's MiB is fine with me
|
concept ACK |
Yes.
Well at least now that the mempool is capped, that ought to free up some memory for other uses. But yes it could be the final straw, sure...
Right - during initial sync (and catch-up) the mempool is virtually guaranteed to be empty. This fact could be used to temporarily bump dbcache. But it's too late for that for 0.13. |
|
Concept ACK for .13 |
src/txdb.h
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: braces should be "(in MiB)" or remove "in"
|
I am (slowly) trying various leveldb cache sizes to see how big it really needs to be. |
|
On a Xeon-D 1541 with 64GB ram, 7200 rpm disk, with no txindex, and all signature checks disabled, I found that: Capping GetOptions ncachesize to 1MB (holding all else constant) resulted in a 1% performance loss and capping at 4MB to a 0.1% loss (31072.23 to reindex instead of 31021.76). (2MB was very close to the 1MB numbers). On this basis I recommend clamping at leveldb 4MB or 8MB (just in case future growth or other workloads makes it matter more), and handing the rest of the memory to the coins cache. |
Thanks for testing! I'll change the maximums to 8 MiB. |
|
Benchmarked this pull req on the above system with reindex (and no signature checking at all), went from 31021.76 seconds to 21303.22. It's still a lot slower than the 'infinite' dbcache size results; but a huge improvement over the old results. ACK. |
|
@gmaxwell I recently enabled Unfortunately, I'm unfamiliar with the exact memory management of LevelDB and what memory is used to build these large Level-0 files. However, if this patch clamps that memory of LevelDB to 8MB it will not be able to create such large Level-0 files and thus will have to do quite a few more lower-level compactions. — @maxwell, it would be nice if you could time an 'infinite dbcache' reindex with |
|
@roques I started that test before commenting above. Will update when it's done. |
|
With dbcache set to 8192, reindex with this patch and no signature checks took 8071.65 seconds, and without 8071.65 seconds. Test with txindex isn't done yet (it was later in my testqueue). |
|
Could set |
|
With txindex, no signature checks, and 8GB dbcache, before this PR 10131.43 and after 11682.22. So it makes a meaningful difference. I'm starting a test with the txindex case at 32 and seeing how that goes. |
|
Added mention in release notes. |
|
Concept ACK |
|
10721.93 with txindex, infinite dbcache, and the 32MB clamp. |
|
Ok, thanks for measuring, so that still suffers. |
|
Tested ACK 1009626d308ff70e3c0457559b87aacd510d0c42. |
Also cap the allocation for the leveldb-specific cache for the UTXO set to 8MiB. This avoids that the extra cache memory goes to the much less effective leveldb cache instead of our application-level cache.
|
Squashed and updated the commit messages for the new values. |
- reduces wallet memory usage - inline with Dash parameters see bitcoin/bitcoin#8273
- reduces wallet memory usage - inline with Dash parameters - reduce DEFAULT_MAX_MEMPOOL_SIZE see bitcoin/bitcoin#8273
73d7288 [Doc] Mention reindex-chainstate in the release notes (random-zebra) c45c0ec Skip MoneySupply update during reindex/reindex-chainstate (random-zebra) efe193f Scan for better chains in ThreadImport (random-zebra) 0aceea3 Make ProcessNewBlock dbp const and update comment (Pieter Wuille) 8255e82 [Cleanup] Remove fVerifyingBlocks global flag (random-zebra) 30c7aed Add -reindex-chainstate that does not rebuild block index (random-zebra) 79d5cb2 Verify DB with original default check-level 3 (random-zebra) ed96859 Reduce default number of blocks to check at startup (Pieter Wuille) d4516fa Log/report in 10% steps during VerifyDB (Jonas Schnelli) cce2c9e doc: Mention dbcache increase in release notes (random-zebra) 11dc022 [GUI] Update default db cache size in the options model (random-zebra) 9b7f764 Bump `-dbcache` default to 300MiB (Wladimir J. van der Laan) Pull request description: This was attempted already in #1864 and #1907. Third time's a charm. Now the speed is acceptable and (unlike what was happening in #1907) the process can be interrupted. Further, as it is performed in ThreadImport, the GUI is open and functional during the chainstate reindex, instead of being seemingly stuck at the splash screen. This PR also includes a few improvements coming from bitcoin#10919, bitcoin#8273, bitcoin#8136 and bitcoin#8611. Here's a quick comparison of the data I had testing here (empty wallet with GUI, empty pivx.conf / default values). The reindexes have been performed with 0 network connections. <table> <tr> <th>Mainnet (height=2847011)</th><th>Master</th><th>this PR</th> </tr><tr> <td>online sync</td><td>8 hr 13 min</td><td>6 hr 42 min</td> </tr><tr> <td>-reindex (offline)</td><td>7 hr 14 min</td><td>6 hr 21 min</td> </tr><tr> <td>-reindex-chainstate (offline)</td><td>N/A</td><td>6 hr 13 min</td> </tr><tr> <td>startup (synced node)</td><td>100 sec</td><td>83 sec</td> </tr><tr> <td>RAM (synced node)</td><td>1.65 GiB</td><td>1.5 GiB</td> </tr><tr> <td>utxo_cache (synced node)</td><td>28.9MiB</td><td>39.5MiB</td> </tr> </table> ACKs for top commit: furszy: re-ACK 73d7288, tested again. Tree-SHA512: fb828d89692ccb6105eae5411b70a3c7a129d98d3101121cf604171de1b818a8c68b3771cc69fcf0a04642fe1327ee7ce360a72ecd7ef019b1614bd83c081de5
Bump
-dbcachedefault value to 300MiB.Also cap the allocations for the leveldb-specific caches to 32MiB, the current default for 100MiB. This avoids that the extra cache memory goes to the much less effective leveldb cache instead of our application-level cache.
Before:
-dbcache-txindexAfter:
-dbcache-txindexNumber in bold is the size allocated to the
CCoinsCachein the default case.See #8245, as well as 2016-06-23 meeting log for discussion.
Note: after this, we also need something like #8138 - currently the dbcache determines how deep undo data is rolled back at start, so otherwise this will result in the start-up verification becoming even slower.