Skip to content
This repository has been archived by the owner on Sep 26, 2019. It is now read-only.

Add a jmh benchmark for WorldStateDownloader #972

Merged
merged 3 commits into from
Feb 26, 2019

Conversation

ajsutton
Copy link
Contributor

PR description

The benchmark is higher level than a JMH benchmark really should be and has to use the generally inadvisable @Setup(Level.Invocation) to ensure that we start from a clean world state on each run. Otherwise the downloader detects the state is already downloaded and completes immediately. Given the benchmark takes multiple seconds the inaccuracy of measurement introduced by Level.Invocation doesn't affect results too much.

Doing a full fast sync using a few full peers would give better data, but this provides some feedback in the meantime.

final WorldStateArchive worldStateArchive = new WorldStateArchive(storage);
final MutableWorldState worldState = worldStateArchive.getMutable();

dataGen.createRandomAccounts(worldState, 10000);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is JMH the right place to try larger states? It wold be interesting to see if the performance decline is linear or exponential, or worse, so we could do world states at 1,000, 10,000, and 100,000, and 1,000,000 to see what the curve is.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JMH turned out to be a fairly poor fit for this type of test - we could parameterise it so we could generate larger states but the runtime is already pretty brutal because we wind up having to recreate that state for every benchmark run and JMH wants to do a lot of runs to check consistency. This will give us some rough numbers to work off for now but to really drill into details a controlled network benchmark running the full node and a single 10-20 minute sync will give us something we can drill into that kind of detail on.

That said, in looking at Rinkeby fast syncs, the rate that we complete nodes is very consistent regardless of how many we've imported already. So it looks to be linear based on the number of nodes.

@ajsutton ajsutton merged commit 7fcd515 into PegaSysEng:master Feb 26, 2019
@ajsutton ajsutton deleted the world-state-benchmark branch February 26, 2019 19:48
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants