Skip to content

Add FlatKV database to the benchmarking utility.#2936

Merged
cody-littley merged 7 commits intomainfrom
cody-littley/benchmark-flatkv
Feb 20, 2026
Merged

Add FlatKV database to the benchmarking utility.#2936
cody-littley merged 7 commits intomainfrom
cody-littley/benchmark-flatkv

Conversation

@cody-littley
Copy link
Contributor

Describe your changes and provide context

Ticket: https://linear.app/seilabs/issue/STO-358/state-db-go-bench-should-testing-all-sc-backends

Add support to the DB benchmarking utility for different DB implementations.

Testing performed to validate your change

I ran the benchmarks locally and verified that they worked as expected.

@github-actions
Copy link

github-actions bot commented Feb 19, 2026

The latest Buf updates on your PR. Results from workflow Buf / buf (pull_request).

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed✅ passedFeb 20, 2026, 7:51 PM

@github-actions
Copy link

The latest Buf updates on your PR. Results from workflow Buf / buf (pull_request).

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed✅ passedFeb 19, 2026, 7:43 PM

@cody-littley cody-littley marked this pull request as ready for review February 19, 2026 19:59
@yzang2019
Copy link
Contributor

Do you mind also updating the readme? Thanks!

cfg := flatkv.DefaultConfig()
cs := flatkv.NewCommitStore(dir, logger.NewNopLogger(), cfg)

_, err := cs.LoadVersion(0, false)
Copy link
Contributor

Choose a reason for hiding this comment

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

Need to remove the extra arg

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

// varying keysPerBlock and numBlocks to find optimal block size.
func BenchmarkWriteWithDifferentBlockSize(b *testing.B) {
func BenchmarkMemIAVLWriteWithDifferentBlockSize(b *testing.B) {
const totalKeys int64 = 1_000_000
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's change this to 100k as well?

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh nvm, it seems 100k isn't accurate enough, we probably wanna test more

Copy link
Contributor

Choose a reason for hiding this comment

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

For the total testing time perspective, maybe still reduce to 100k level, and use a smaller batch size like 1,2,10,20 and up till 100,200?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

change made

@codecov
Copy link

codecov bot commented Feb 19, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 57.77%. Comparing base (e82324c) to head (a64603e).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #2936   +/-   ##
=======================================
  Coverage   57.76%   57.77%           
=======================================
  Files        2111     2111           
  Lines      174235   174217   -18     
=======================================
  Hits       100649   100649           
+ Misses      64631    64613   -18     
  Partials     8955     8955           
Flag Coverage Δ
sei-db 68.42% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
sei-db/state_db/bench/helper.go 0.00% <ø> (ø)
🚀 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.

@blindchaser
Copy link
Contributor

seems like the current benchmarks have high variance, I get different numbers each time. Is there a way to reduce or eliminate this variability?

@cody-littley
Copy link
Contributor Author

@yzang2019

Do you mind also updating the readme? Thanks!

Readme updated

@cody-littley
Copy link
Contributor Author

cody-littley commented Feb 20, 2026

@blindchaser

seems like the current benchmarks have high variance, I get different numbers each time. Is there a way to reduce or eliminate this variability?

My first instinct on this is that the regular suite of benchmarks is very short for a DB test. In the past when I've done DB benchmarking, I often observe that it takes minutes or hours for DB performance to reach steady state performance. Some of these tests are completing in ~15 seconds on my laptop. Good for a first pass approximation, but insufficient for a high fidelity reading.

@yzang2019
Copy link
Contributor

yzang2019 commented Feb 20, 2026

seems like the current benchmarks have high variance, I get different numbers each time. Is there a way to reduce or eliminate this variability?

We can have a separate PR to address that issue, I don't think it's a blocker for this PR

@cody-littley cody-littley merged commit 31b1f6d into main Feb 20, 2026
48 of 50 checks passed
@cody-littley cody-littley deleted the cody-littley/benchmark-flatkv branch February 20, 2026 21:04
yzang2019 pushed a commit that referenced this pull request Feb 25, 2026
Ticket:
https://linear.app/seilabs/issue/STO-358/state-db-go-bench-should-testing-all-sc-backends

Add support to the DB benchmarking utility for different DB
implementations.

I ran the benchmarks locally and verified that they worked as expected.

---------

Co-authored-by: Cody Littley <cody.littley@seinetwork.io>
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.

3 participants