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

Add tool to test application of txs to ledger #14582

Merged
merged 11 commits into from
Aug 27, 2024

Conversation

georgeee
Copy link
Member

@georgeee georgeee commented Nov 20, 2023

Benchmark-like tool that creates a set number of 9-account-updates transactions and applies them to a given ledger.

Explain how you tested your changes:

  • Ran a tool against mainnet-like ledger and measure performance

How to use the tool:

MINA_PRIVKEY_PASS= mina ledger test-apply --ledger-path ledger --privkey-path key --num-txs 128

Checklist:

  • Dependency versions are unchanged
    • Notify Velocity team if dependencies must change in CI
  • Modified the current draft of release notes with details on what is completed or incomplete within this project
  • Document code purpose, how to use it
    • Mention expected invariants, implicit constraints
  • Tests were added for the new behavior
    • Document test purpose, significance of failures
    • Test names should reflect their purpose
  • All tests pass (CI will check this if you didn't)
  • Serialized types are in stable-versioned modules
  • Does this close issues? None

@georgeee georgeee requested a review from a team as a code owner November 20, 2023 17:13
@georgeee georgeee force-pushed the georgeee/test-max-block-ledger-application branch 3 times, most recently from 60a8ceb to 8da7d20 Compare November 23, 2023 12:19
@georgeee georgeee requested review from a team as code owners November 23, 2023 12:19
@georgeee georgeee changed the base branch from berkeley to rampup November 23, 2023 12:19
@georgeee georgeee force-pushed the georgeee/test-max-block-ledger-application branch 4 times, most recently from 1811f12 to 8557d61 Compare December 1, 2023 14:02
@georgeee georgeee force-pushed the georgeee/test-max-block-ledger-application branch from 8557d61 to f506b51 Compare December 16, 2023 15:07
| Ok keypair ->
keypair
| Error err ->
eprintf "Could not read the specified keypair: %s\n"
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe use the logger above for all these eprintf? what do you think?

Copy link
Contributor

@emberian emberian left a comment

Choose a reason for hiding this comment

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

Looks good. I don't know where to get a serialized block myself. Should we have this run in CI (with small parameters)?

@georgeee
Copy link
Member Author

georgeee commented Jan 9, 2024

@emberian I was using block serializations we get from the uptime system, but probably there are less exotic ways to get it.

I definitely want to come up with a more friendly flow when start working on #14800

@georgeee georgeee force-pushed the georgeee/test-max-block-ledger-application branch from f506b51 to 0045dd0 Compare August 25, 2024 16:28
@georgeee georgeee changed the base branch from rampup to compatible August 25, 2024 16:32
Block doesn't seem to impact the performance of the staged ledger
application.

Allowing to run without it simplifies the flow.
@georgeee
Copy link
Member Author

georgeee commented Aug 26, 2024

How to run the benchmark

Assuming mina is built with devnet profile:

MINA_PRIVKEY_PASS= mina ledger test-apply --num-txs 128 --ledger-path ledger --privkey-path key

where:

  • ledger is an unpacked directory with contents of a genesis ledger from the archive.
  • key is a secret key from file

The output will look like:

Init root jxDivUg42TF8bYRCojgBAcXZkCRWpBVLoQcBy8u3kdi9uqNgaCu                                                                                                                               Result of application 0: true (took 42.978286743164062ms): new root jxx9niKXgim3fijPFh7GeHpvbJUGtoorC7aaXLtbBThuS7weoEE
Result of application 1: true (took 53.806781768798828ms): new root jxzUn1JXpRptqZ2zct2Tfgr5hF9xsQL38cxYWs2f4AT5qayUKPg
Result of application 2: true (took 48.964262008666992ms): new root jxeQbrb68q4efgivqZz5XX6vuzC68uyAuyJqqWcJdTUSKjwcnJ8
Result of application 3: true (took 52.176713943481445ms): new root jxncmbctCCZRpCZvRLrGj8rk174r4MR3YSS5ZqRaLvjwnrWXAhw
Result of application 4: true (took 43.39289665222168ms): new root jx5NpQz3f8sF63yjidmXE8QTv91jF9SRPHY47Zb59NNDDtHxUXH
....
....
....
Result of application 574: true (took 60.74070930480957ms): new root jwdgzX3ufDjra967AURYai1W9Gk8MKb7Pu4LmtkrZaqc9Fv9J7e
Result of application 575: true (took 60.318946838378906ms): new root jx3HRNFQTMTRWp9o8YNBrfqWcAyH5LT8BcuQT74a77M1QXWHVp7
Result of application 576: true (took 59.606313705444336ms): new root jwojN8v5nLyYsPkiNsrF8g8gqHKiwKpiN5JEikZBFLk1dgv9DmN
Result of application 577: true (took 56.887388229370117ms): new root jxbioQSEwPesBpQN8tNrV2CTXcDDvnXcJ3rWfuX7C9ZaEmRPa6V
Result of application 578: true (took 55.930376052856445ms): new root jxFTQKgTa3HrY6UBvmmY5bpwYSUNAsQmR5dcQrJ2VunLfg6gA3m
Result of application 579: true (took 62.193393707275391ms): new root jwbw8BWqnM41BBsvnyXeeghGCPzcgjhAXBtejeDfC3tKG9b5sKi
Result of application 580: true (took 2.4975223541259766s): new root jx6HwhECxAme3ycDu7ZyyEMfoV63eHE4Y1ahzbQfDqHpxRrhHbc

Benchmark is structured in two phases:

  • Preparatory phase: apply 580 (controlled via --rounds) transaction payloads to the ledger:
    • each in the same way as if these represented transactions of a block
    • each payload consisting of 3 transactions (controlled via --num-txs-per-round)
  • Measurement phase: apply a single payload of N transactions (with N controlled via --num-txs)
    • each transaction consisting of 8 signature-backed account updates (+ one more account update for the fee payer)

So the benchmark simulates a single pass of ledger application of a full block. This is not a real benchmark, ina way that we run this only once. In future iterations I want to change the format and use the core_bench, but I think this PR is good to be merged as is.

@georgeee
Copy link
Member Author

!ci-build-me

@georgeee georgeee merged commit 0cd5cef into compatible Aug 27, 2024
44 checks passed
@georgeee georgeee deleted the georgeee/test-max-block-ledger-application branch August 27, 2024 13:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants