-
Notifications
You must be signed in to change notification settings - Fork 38.7k
CreateNewBlock performance improvements #2677
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
|
test conditions: on my VPS, a bitcoind patched to ignore the dust filtering and free relay limiting, and sending a "mempool" to every peer at connect time, waited until poolsz >5000, then measure getblocktemplate RPC latency. Result: 10-20s without this patch, 0.5-0.7s with this patch. EDIT: up to 1.0-1.5s after running for several hours (poolsz still ~5000). |
|
Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/2ec349bc420d7f4541bf91acf8b830377a1421f3 for binaries and test log. |
|
I'm not familiar enough with the code and the template structure to know what is possible so please bear with my uneducated suggestion. Would it make sense to have part of the template being computed asynchronously? |
|
@gyver Thats what miner software should and (some) does do. .. but at some point you need to compute the data... and it's good if it's not a slow and expensive operation. |
|
ACK |
|
@gmaxwell of course I agree speeding up the actual computation is desirable. I was wondering if it wouldn't make sense to implement this async technique in bitcoind itself. For example I suspect (again: uninformed guess) that slow calls to getmininginfo and getblocktemplate use the same access pattern to an internal tx structure and could benefit from the same optimization (at least they became slow on my node when the number of tx started to grow). At some point when multiple tools all implement the same algorithm on top of another tool the question of integrating this algorithm in the common tool becomes valid (the answer isn't always obvious though). It's just an idea to test the waters (mainly to avoid wasting time with it if the template build process intrinsically can't benefit from this approach), it's far from a feature request. I'm more and more interested by the node's source code and how I could play with it but I just scraped the surface... |
|
@gmaxwell still thinking about your suggestion and focusing on how miner software can optimize their latency when a new block is accepted by the local node. The miner doesn't want to use an old cached template to avoid wasting work but can't simply call getblocktemplate naively if it wants a fast reply (event after a new block there can be and often is a lot of transactions to include in a template). |
|
@gyver Eloipool is free software an implements the optimizations you appear to be describing there. (precomputed empty templates and such). |
|
@gmaxwell thanks for the pointer. Was already in my large bag of source code to read but moved near the top of the pile :) |
CreateNewBlock performance improvements
CreateNewBlock performance improvements
Remove some unnecessary copying and coins view cache layers in CreateNewBlock.
This results in a >10x speedup for GBT for me, with a large mempool (poolsz >5000).