Skip to content

Conversation

@kurtisc
Copy link
Contributor

@kurtisc kurtisc commented Dec 12, 2025

Closes RV-828

What

A benchmark for the durable storage system at the layer of the Database type, e.g.:

                    commands go in here
                  /
                 v
          Database
-------------------------------
Merkle layer | Persistence layer

Why

It's important to know that the current design of the durable storage system is feasible. When optimising parts of the system, we also want to know if they are effective.

How

  1. Populates a large tree
  2. Deserialises a list of operations defining a typical ERC-20 transaction
  3. Runs the transaction 10000 times

A feature (bench_cloning) has been added to allow benchmarking with and without cloning the Database. This is due to a bug RV-855 where the implementation of cloning the persistence layer is too slow.

Manually Testing

cargo bench --features bench --bench "database"
cargo bench --features bench,bench_cloning --bench "database"

Tasks for the Author

  • Link all Linear issues related to this MR using magic words (e.g. part of, relates to, closes).
  • Eliminate dead code and other spurious artefacts introduced in your changes.
  • Document new public functions, methods and types.
  • Make sure the documentation for updated functions, methods, and types is correct.
  • Add tests for bugs that have been fixed.
  • Explain changes to regression test captures when applicable.
  • Write commit messages in agreement with our guidelines.
  • Self-review your changes to ensure they are high-quality.
  • Complete all of the above before assigning this MR to reviewers.

@kurtisc kurtisc changed the base branch from main to kurtis/durable-storage/database-clone December 12, 2025 12:01
@codecov
Copy link

codecov bot commented Dec 12, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.00%. Comparing base (0f488ae) to head (38bad96).
⚠️ Report is 8 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #597      +/-   ##
==========================================
+ Coverage   89.61%   91.00%   +1.38%     
==========================================
  Files         113      111       -2     
  Lines       20457    20101     -356     
  Branches    20457    20101     -356     
==========================================
- Hits        18332    18292      -40     
+ Misses       1749     1433     -316     
  Partials      376      376              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@kurtisc kurtisc force-pushed the kurtis/durable-storage/benchmark branch from afd6615 to 58c570e Compare December 12, 2025 12:46
Base automatically changed from kurtis/durable-storage/database-clone to main December 12, 2025 13:25
@kurtisc kurtisc force-pushed the kurtis/durable-storage/benchmark branch from 58c570e to 786de2e Compare December 15, 2025 12:57
@kurtisc kurtisc marked this pull request as ready for review December 15, 2025 12:59
@github-actions
Copy link

github-actions bot commented Dec 15, 2025

Benchmark results for revision 88421a9:

Metric Duration TPS
Mean 1.512094521s 26.454
Worst 1.525607802s 26.219
Best 1.490554923s 26.836
Standard Deviation ±7.767013ms ±0.136
Full results
Run Transfers Duration TPS
1 40 1.512723318s 26.442
2 40 1.516678012s 26.373
3 40 1.490554923s 26.836
4 40 1.500020806s 26.666
5 40 1.517706699s 26.356
6 40 1.516130857s 26.383
7 40 1.525607802s 26.219
8 40 1.512564004s 26.445
9 40 1.52228952s 26.276
10 40 1.507029889s 26.542
11 40 1.516444895s 26.377
12 40 1.516021364s 26.385
13 40 1.50621355s 26.557
14 40 1.50878626s 26.511
15 40 1.509429223s 26.500
16 40 1.51097141s 26.473
17 40 1.51233239s 26.449
18 40 1.522425416s 26.274
19 40 1.509598756s 26.497
20 40 1.508361318s 26.519

Compare the results above with those for the default branch.

Copy link
Contributor

@danielpapp-trilitech danielpapp-trilitech left a comment

Choose a reason for hiding this comment

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

Overall, it looks good. I think the large read size is off by a magnitude, and you might also want to include a large write, which has the same as the large read.

@kurtisc kurtisc force-pushed the kurtis/durable-storage/benchmark branch 2 times, most recently from 376e872 to 3720be8 Compare December 15, 2025 17:25
@kurtisc
Copy link
Contributor Author

kurtisc commented Dec 15, 2025

@danielpapp-trilitech Many changes and a rebase here, including renaming the main file, sorry it's all mixed up.

@kurtisc kurtisc force-pushed the kurtis/durable-storage/benchmark branch 3 times, most recently from 9c930b8 to a580533 Compare January 7, 2026 17:18
@kurtisc
Copy link
Contributor Author

kurtisc commented Jan 8, 2026

The poor performance of Clone is making this take too long to run, moving into draft briefly while I try to resolve this

@kurtisc kurtisc marked this pull request as draft January 8, 2026 09:39
@kurtisc kurtisc force-pushed the kurtis/durable-storage/benchmark branch 2 times, most recently from 3754821 to 8552f8f Compare January 8, 2026 12:16
@kurtisc kurtisc marked this pull request as ready for review January 8, 2026 12:27
@kurtisc kurtisc force-pushed the kurtis/durable-storage/benchmark branch from 8552f8f to 3e91035 Compare January 8, 2026 15:34
Copy link
Contributor

Looks good to me! Good job in using the json that Victor created! How much time does it take to run this?

@kurtisc
Copy link
Contributor Author

kurtisc commented Jan 12, 2026

How much time does it take to run this?

Currently it takes 2 minutes to run and the time for a measurement is 4.9s

Most of this is in persistence layer operations, which is preferable, but the erc20 transaction has a lot more operations than I was expecting (132). I think it would be good to add a tool which can generate the store_accesses.json file without Victor having to edit it manually.

@kurtisc kurtisc force-pushed the kurtis/durable-storage/benchmark branch from f8391a5 to b7f6113 Compare January 12, 2026 09:29
Copy link
Contributor

@NSant215 NSant215 left a comment

Choose a reason for hiding this comment

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

Overall I think looks good - I got a bit confused that methods written in one commit were immediately changed in the next between commits 2 and 3 - perhaps they can be squashed? or is there good reason to separate them?

@kurtisc
Copy link
Contributor Author

kurtisc commented Jan 12, 2026

How much time does it take to run this?

Currently it takes 2 minutes to run and the time for a measurement is 4.9s

Most of this is in persistence layer operations, which is preferable, but the erc20 transaction has a lot more operations than I was expecting (132). I think it would be good to add a tool which can generate the store_accesses.json file without Victor having to edit it manually.

Never mind, I've spoken to Joel and the 132 includes setup and block creation, which don't need to be done 10000 times like the transaction itself.

@kurtisc kurtisc force-pushed the kurtis/durable-storage/benchmark branch 3 times, most recently from 5c08ca3 to bdd758d Compare January 12, 2026 11:38
@kurtisc kurtisc force-pushed the kurtis/durable-storage/benchmark branch 3 times, most recently from 73d4fe0 to 710ae11 Compare January 12, 2026 11:53
@kurtisc
Copy link
Contributor Author

kurtisc commented Jan 12, 2026

I got a bit confused that methods written in one commit were immediately changed in the next between commits 2 and 3 - perhaps they can be squashed? or is there good reason to separate them?

I don't see why not. I wanted to separate the json parsing into its own commit but I think it causes more confusion/temporary code than it is worth.

@kurtisc kurtisc force-pushed the kurtis/durable-storage/benchmark branch 9 times, most recently from f31e0fc to 4e4ea93 Compare January 12, 2026 13:45
@kurtisc kurtisc requested a review from NSant215 January 12, 2026 13:47
@kurtisc kurtisc enabled auto-merge January 12, 2026 16:01
Benchmarks the `Database` layer of durable storage using a sequence of
operations taken from an Etherlink transaction.
@kurtisc kurtisc force-pushed the kurtis/durable-storage/benchmark branch from 4e4ea93 to 38bad96 Compare January 12, 2026 16:34
@kurtisc kurtisc added this pull request to the merge queue Jan 13, 2026
Merged via the queue into main with commit 5d6a2e2 Jan 13, 2026
8 checks passed
@kurtisc kurtisc deleted the kurtis/durable-storage/benchmark branch January 13, 2026 13:03
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.

6 participants