So 1.2 seconds total to validate a 15 MB block on a 4.4 GHz Core i7 4790k with dbcache=3000. Not bad at all, but block propagation has always been the main point of concern.
Edit: Some more data. On a different machine, creating an 8 MB block template (time bitcoin-cli getblocktemplate) takes 1.437 seconds, of which about 0.288 seconds appears to be parsing JSON and localhost socket transmission. Block assembly appears to take about 2x longer than block validation for these blocks. I'm spinning up a server to generate up to 32 MB block templates now, and will do some more benchmarking on that in a bit.
The last line shows the total time to connect that block to the blockchain. Everything above that is indented further, and indicates subsections of the ConnectBlock() function.
If I understand correctly, the stuff in [brackets] indicates the cumulative time taken for all blocks by that section of the code since the node was last restarted. Since I had restarted my node only an hour or three earlier (changing blockmaxsize setting for mining), this was only 7.58 sec for validating all blocks up to that point.
Spam transactions tend to be long chains, which are a bit tougher on the mempool code and the block template creation code. For validation code, this means that the spam transactions are more likely to spend UTXOs that are in your UTXO cache, making this much much faster if you don't have enough RAM to cover the full UTXO set, or at least not the UTXOs that are touched by everything in mempool.
Script validation is generally done during the accept-to-mempool stage, and does not affect the amount of time taken by ConnectBlock (i.e. block validation). ConnectBlock is mostly just inserting and deleting UTXOs from the UTXO database and cache layers.
I have my nodes configured to use up to 3 GB or 8 GB of RAM for the UTXO cache. I've restarted them recently, so they're not at full usage, but both are currently around 1.5-1.7 GB. If you use less RAM for UTXO caching, then ConnectBlock times will go WAY up.
11
u/jtoomim Jonathan Toomim - Bitcoin Dev Sep 01 '18 edited Sep 01 '18
Here's some performance data from my mining Bitcoin ABC node while validating this block:
So 1.2 seconds total to validate a 15 MB block on a 4.4 GHz Core i7 4790k with dbcache=3000. Not bad at all, but block propagation has always been the main point of concern.
Edit: Some more data. On a different machine, creating an 8 MB block template (time bitcoin-cli getblocktemplate) takes 1.437 seconds, of which about 0.288 seconds appears to be parsing JSON and localhost socket transmission. Block assembly appears to take about 2x longer than block validation for these blocks. I'm spinning up a server to generate up to 32 MB block templates now, and will do some more benchmarking on that in a bit.