-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
perf(anvil
): enhance block mining performance in Anvil node for high throughput and efficiency
#7039
Comments
it likely spends most of the time cleaning up / updating old state could you try with There's definitely room for significant improvements here |
@mattsse I am using https://github.com/mshakeg/anvil-backtester/blob/main/shell/anvil.sh Removing |
hmm, could you perhaps run this with samply https://github.com/mstange/samply and see if anything sticks out I'll try to investigate shortly |
@mattsse thanks, don't really know what to make of the profile, but I've attached the trace on
|
thanks! will investigate, but looks like stateroot |
@mattsse thanks, might be a good idea to have flags that disable logic not really needed on a local node, similar to how the |
anvil
): enhance block mining performance in Anvil node for high throughput and efficiency
Relevant conversation in #7546: #7546 (comment) |
@mshakeg I retried your test driver with latest anvil and got following results
best result in couple of tries (when reinstalled anvil)
Note that I have to restart anvil between runs because of which locks test driver on subsequent
Would this be a reasonable enhancement in scope of this ticket? Thank you |
bump @mshakeg please check comment above. thanks! |
@grandizzy are you referring to the locking issue? if so then I wouldn't say it's related to this issue, so maybe open a new issue if there isn't already one? |
@mshakeg not to the locking issue ( that's some not in our control but ethersjs see also #7275 (comment) |
@grandizzy sure, though have you done some profiling to determine why the large TPS discrepancy? If much time is spent mining blocks(and computing merkl roots when mined for example) that could be disabled in a local node then agreed with adding an option to skip these computations for an even more performant local node. |
I just retested the original issue with latest anvil version and noticed different numbers, hence my question if still a problem and continue investigation or if it could be closed |
I think this explain it #5499 (comment) |
Component
Anvil
Describe the feature you would like
I propose a performance enhancement for the Anvil node, specifically targeting the efficiency of block mining. Through some tests I've observed that while Anvil demonstrates impressive transaction processing capabilities, there's a noticeable disparity in throughput efficiency primarily attributed to the time spent mining blocks. This feature request seeks optimizations in Anvil's block mining to reduce execution time, thereby increasing the overall transactions per second (TPS) throughput and making the node more suitable for applications requiring high transaction processing speeds as well as frequent mining of blocks.
Additional context
Anvil version: 0.2.0 (2cf84d9 2024-02-07T00:15:49.622159000Z)
To illustrate the current performance characteristics and provide a basis for this request, I conducted a test using a Uniswap V3 transaction replay script. The findings highlight a significant potential for performance gains in block mining processes. For instance, when increasing the
nullSwapsPerBlock
from 1 to 2000, the average TPS improved dramatically(by a factor of 7x), indicating that the node spends a significant portion of time mining blocks vs actual transaction execution. To replicate this test:pnpm i
)pnpm anvil:start
pnpm test:anvil-memory
withnullSwapsPerBlock
set to 1 and then again set to 2000 and observe results similar to the following indicating significant overhead in mining blocks:The text was updated successfully, but these errors were encountered: