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

perf: rework benchmarks #1044

Merged
merged 63 commits into from
Feb 12, 2023
Merged

perf: rework benchmarks #1044

merged 63 commits into from
Feb 12, 2023

Conversation

TarikGul
Copy link
Member

@TarikGul TarikGul commented Sep 3, 2022

Sidecar Benchmarks

Sidecar's benchmarks utilize lua, wrk, and an archive node (local). This PR aims at completely a few things:

  • Providing benchmarks for every available endpoint that can be queried against a polkadot archive node.
  • Writing a script that would allow simple access to benchmarking for either one or all endpoints.
  • Having the script write the results to a benchmarks.txt file in the root of the repository.
  • Re-activate eslint for the scripts folder (This is what makes the PR seem a little bigger than it should be).

The script

This script's purpose is to run the benchmarks inside of the <root>/benchmarks directory. This script requires you to have wrk, lua, and a fully synced archive node. Please reference <root>/benchmarks/README.md for more information on installation.

In order to start this script locally, run from the root directory of this repository:

ex1:

$ yarn
$ yarn bench

ex2:

$ yarn
$ yarn bench --log-level=info --time=30s  

ex3:

$ yarn
$ yarn bench --log-level=info --time=30s  --endpoint=/accounts/{accountId}/balance-info

Flags

--ws-url: The Ws Url to run the benchmarks against. Default is ws://127.0.0.1:9944.

--endpoint: Run a single benchmark by specificing which endpoint to run. If this is absent it will run all benchmarks.

--log-level: The log-level to run the benchmarks in. Defaults to http.

--time: The amount of time each benchmark should run for. Ex: 1m, 30s, 15s. Default is 1m.

  • Benches for all endpoints.
    • /accounts/{accountId}/balance-info
    • /accounts/{accountId}/vesting-info
    • /accounts/{accountId}/validate
    • /accounts/{accountId}/convert
    • /accounts/{accountId}/staking-info
    • /accounts/{accountId}/staking-payouts
    • /blocks/{blockId}
    • /pallets/staking/progress
    • /pallets/{palletId}/storage
    • /pallets/{palletId}/storage/{storageItemId}
    • /pallets/nomination-pools/info
    • /pallets/nomination-pools/{poolId}
    • /pallets/{palletId}/errors
    • /pallets/{palletId}/errors/{errorItemId}
    • /pallets/staking/validators
    • /transaction/material
    • /runtime/spec
    • /paras
    • /paras/leases/current
    • /paras/auctions/current
    • /paras/crowdloans
    • /paras/{paraId}/crowdloan-info
    • /paras/{paraId}/lease-info
    • /blocks/{blockId}/header
    • /blocks/{blockId}/extrinsics/{extrinsicIndex}
    • /blocks/head
    • /blocks/head/header
    • /node/network
    • /node/transaction-pool
    • /node/version
  • flushed out Lua util module
  • README is finished with instructions on running locally in both linux and mac
  • Script to run one or all benchmarks

closes: #1050

@TarikGul TarikGul self-assigned this Sep 3, 2022
@TarikGul TarikGul requested a review from a team as a code owner September 3, 2022 18:47
@TarikGul TarikGul added A3 - In Progress PR in progress, not ready for review I8 - Enhancement Additional feature request labels Sep 3, 2022
@TarikGul
Copy link
Member Author

TarikGul commented Sep 6, 2022

@radupopa2010 Hey just wanted to give you a heads up as well, I am completely reworking the benchmarks in this PR. I will ping you when I work through the CI portion which should be sometime this week when I get the rest finished

cc: @alvicsam

@TarikGul TarikGul changed the title [WIP] perf: rework benchmarks perf: rework benchmarks Feb 3, 2023
required: false,
nargs: '?',
type: checkWsType,
default: 'ws://127.0.0.1:9944',
Copy link
Contributor

Choose a reason for hiding this comment

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

what would happen if we specify one of our public endpoints here (f.e. "wss://rpc.polkadot.io")?

Copy link
Member Author

Choose a reason for hiding this comment

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

It would use the public endpoint with no problem, but it is highly not recommended to use a public endpoint.

Why?: Because the benchmarks will send hundreds of thousands of requests, and we don't want to flood it with storage queries.

@IkerAlus
Copy link
Contributor

IkerAlus commented Feb 8, 2023

Couple of questions before actually running this:

  • The performance of certain endpoints are highly dependent on the current (or at specific timepoint) status of the network (f.e., transaction pool may be empty or full). Will this be somehow captured in the benchmark report?
  • Could this be run being connected to a public endpoint node and/or a non-archive node (assuming we omit those endpoints that query the blockchain in the past?

@TarikGul
Copy link
Member Author

TarikGul commented Feb 8, 2023

Couple of questions before actually running this:

  • The performance of certain endpoints are highly dependent on the current (or at specific timepoint) status of the network (f.e., transaction pool may be empty or full). Will this be somehow captured in the benchmark report?
  • Could this be run being connected to a public endpoint node and/or a non-archive node (assuming we omit those endpoints that query the blockchain in the past?

Will this be somehow captured in the benchmark report?

So no because we should only be querying a local archive node, and not a public node. Most of the benchmarks work with historic blocks, there are some exceptions though. If the transaction-pool is full or not doesn't have a huge impact in my experience from running the benchmarks for a while now (But if it does it'll have a small impact as the amount of queries are so large that it will be a small outlier).

Could this be run being connected to a public endpoint node and/or a non-archive node (assuming we omit those endpoints that query the blockchain in the past?

As mentioned above too we definitely don't want to benchmark against public live nodes because of the stress the benchmarks would impose upon the network.

Copy link
Collaborator

@marshacb marshacb left a comment

Choose a reason for hiding this comment

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

running benchmarks worked great. lgtm!

Copy link
Contributor

@IkerAlus IkerAlus left a comment

Choose a reason for hiding this comment

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

Ran benchmarks, checked several lightweight endpoints and errors, everything as expected.

Amazing work!

@TarikGul TarikGul removed the A3 - In Progress PR in progress, not ready for review label Feb 12, 2023
@TarikGul TarikGul merged commit 3189864 into master Feb 12, 2023
@TarikGul TarikGul deleted the tarik-bench branch February 12, 2023 14:45
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I8 - Enhancement Additional feature request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tracking: Expand benchmarks for all endpoints.
3 participants