Parallel hashing#20488
Conversation
|
This is now up for a benchmark full sync: https://geth-bench.ethdevops.io/d/Jpk-Be5Wk/dual-geth?orgId=1&var-exp=mon08&var-master=mon09&var-percentile=50&from=1577792859000&to=now |
|
Some preliminary charts. So, this PR only does paralell hashing if the number of updates is 100 or more, so as you can see, it has basically no effect pre-byzantium (when we hash in between every tx). However, the effect post-byz is very visible: Here's a bit more zoom = this PR is pretty stable at about |
|
After 4 days (
|
|
After ~5 days, |
|
The other one (#20493) , running on |
| if h.parallel { | ||
| var wg sync.WaitGroup | ||
| wg.Add(16) | ||
| for i := 0; i < 16; i++ { |
There was a problem hiding this comment.
You probably want to do runtime.NumCPU or runtime.GOMAXPROCS here instead of hard coding 16. Or maybe tke the minimum of the two. If I have only 4 cores available, I don't think running on 16 threads helps.
There was a problem hiding this comment.
Ah, you're hashing each child on a separate goroutine. Hmm, what if the first full node is not that dense. Though to be honest, it probably is the densest apart from attacker tries.
There was a problem hiding this comment.
Yeah, so this branches off at the topmost fullnode, which in all likelihood will be pretty well balanced and dense
| db *Database | ||
| root node | ||
| // Keep a rough track of the number of leafs to commit | ||
| dirtyCount int |
There was a problem hiding this comment.
Might also add to the docs that the statedb deduplicates writes and only does a trie update when the data is actually pushed to the database, so this counter will actually be pretty precise.
There was a problem hiding this comment.
It will be pretty precise, but I'm increasing it for deletions aswell, so that will cause some skew
There was a problem hiding this comment.
We should probably drop this field if it's not used (yet)
|
Let's do #20481 first, and once that one is 'done', I'll rebase this and fix the hasher-specific things |
|
When this was executed without the paralell hashing, this was the result:
With the addition of parallel hashing, the new results are, it hit |
|
On |
aa281e7 to
97c622c
Compare
97c622c to
75d4f20
Compare
|
Rebased on top of master -- PTAL @karalabe |
75d4f20 to
0b66424
Compare
0b66424 to
5f0d62c
Compare
…#20488) * trie: make hasher parallel when number of changes are large * trie: remove unused field dirtyCount * trie: rename unhashedCount/unhashed





This is a follow-up to #20481 , which implements
The benchmarks below are against #20481
Here are the benchmarks against master:
Once the current benchmark run is done, I'll put this one up