Skip to content
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

benchmark async vs. sync http providers #2002

Merged
merged 1 commit into from
May 28, 2021

Conversation

wolovim
Copy link
Member

@wolovim wolovim commented May 21, 2021

What was wrong?

Async http provider is under way; time to benchmark vs. the sync provider.

Update: turns out not much in the case of our CI resources and a locally running Geth node. Local tests with a remote node provider produced more dramatic results.

I think this is a reasonable starting point; the scope of benchmarks can grow from here.

To run the benchmarks locally: make benchmark

Todo:

Cute Animal Picture

Put a link to a cute animal picture inside the parenthesis-->

@wolovim wolovim force-pushed the benchmark-async branch 4 times, most recently from 5ff63a6 to 3bbc870 Compare May 24, 2021 14:52
@wolovim wolovim force-pushed the benchmark-async branch from 3bbc870 to 96b457d Compare May 26, 2021 19:41
@wolovim wolovim requested a review from kclowes May 26, 2021 20:17
@wolovim wolovim changed the title [wip] benchmark async vs. sync http providers benchmark async vs. sync http providers May 26, 2021
Copy link
Collaborator

@kclowes kclowes left a comment

Choose a reason for hiding this comment

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

LGTM! 🚀

loop = asyncio.get_event_loop()
async_w3_http = loop.run_until_complete(build_async_w3_http(fixture.endpoint_uri))

methods = [
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe worth pulling this out into a constant?

Copy link
Member Author

Choose a reason for hiding this comment

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

There's probably a good way to clean this up a bit, but the methods rely on the providers built within this context. Will revisit next iteration.

basepython=python
commands=
python {toxinidir}/web3/tools/benchmark/main.py --num-calls 5
python {toxinidir}/web3/tools/benchmark/main.py --num-calls 50
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just curious - what's the reasoning behind testing 5, 50, and 100 calls here and not just checking one?

Copy link
Member Author

Choose a reason for hiding this comment

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

Once the suite is more mature, we should have vectors for benchmarking (the average of) 1 call vs. 1 call; this would be useful for comparing the HTTPProvider vs. IPCProvider, for example. I think making many calls is the best way to showcase the difference between AsyncHTTPProvider vs. HTTPProvider performance.

@wolovim wolovim merged commit 55cd3cb into ethereum:master May 28, 2021
@wolovim wolovim deleted the benchmark-async branch May 28, 2021 16:59
@wolovim wolovim mentioned this pull request Jun 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants