Skip to content

EVM RPC read benchmark script for state store load testing#3004

Merged
Kbhat1 merged 23 commits intomainfrom
kartik/ss-read-benchmark
Mar 18, 2026
Merged

EVM RPC read benchmark script for state store load testing#3004
Kbhat1 merged 23 commits intomainfrom
kartik/ss-read-benchmark

Conversation

@Kbhat1
Copy link
Contributor

@Kbhat1 Kbhat1 commented Mar 3, 2026

Describe your changes and provide context

  • Adds an EVM RPC read benchmark tool for e2e node debug_trace and state-store load testing

  • Hits heavy trace endpoints plus common state reads, including eth_getLogs, and reports latency/RPS across per-method and mixed workloads

  • Includes lightweight per-block trace summaries and optional PNG plots to help spot trace performance patterns.

Testing performed to validate your change

  • Verified fully on node

Example:

latency_vs_gas

Hammers a node endpoint with debug_traceBlockByNumber,
debug_traceTransaction, eth_getBalance, eth_getStorageAt, eth_getCode,
and eth_getTransactionCount across 5 phases (sequential, concurrent,
per-method, mixed workload). Reports p50/p95/p99 latencies and rps.

Made-with: Cursor
@github-actions
Copy link

github-actions bot commented Mar 3, 2026

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

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed✅ passedMar 18, 2026, 3:30 AM

@codecov
Copy link

codecov bot commented Mar 3, 2026

Codecov Report

❌ Patch coverage is 0% with 527 lines in your changes missing coverage. Please review.
✅ Project coverage is 58.59%. Comparing base (42245eb) to head (1b5494c).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
sei-db/tools/rpc_bench/main.go 0.00% 527 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3004      +/-   ##
==========================================
- Coverage   58.76%   58.59%   -0.17%     
==========================================
  Files        2090     2091       +1     
  Lines      172323   172841     +518     
==========================================
+ Hits       101257   101269      +12     
- Misses      62090    62597     +507     
+ Partials     8976     8975       -1     
Flag Coverage Δ
sei-chain-pr 0.00% <0.00%> (?)
sei-db 70.41% <ø> (ø)

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

Files with missing lines Coverage Δ
sei-db/tools/rpc_bench/main.go 0.00% <0.00%> (ø)

... and 25 files with indirect coverage changes

🚀 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.

Comment on lines +222 to +224
for _, s := range stats {
s.Duration = elapsed
}

Check warning

Code scanning / CodeQL

Iteration over map Warning

Iteration over map may be a possible source of non-determinism
if len(s.Latencies) == 0 {
return 0
}
idx := int(float64(len(s.Latencies)) * pct)

Check notice

Code scanning / CodeQL

Floating point arithmetic Note

Floating point arithmetic operations are not associative and a possible source of non-determinism
}
return s.Latencies[idx]
}
rps := float64(s.Total) / s.Duration.Seconds()

Check notice

Code scanning / CodeQL

Floating point arithmetic Note

Floating point arithmetic operations are not associative and a possible source of non-determinism
Comment on lines +205 to +211
go func() {
defer wg.Done()
for idx := range work {
method, lat, err := workFn(idx)
record(method, lat, err)
}
}()

Check notice

Code scanning / CodeQL

Spawning a Go routine Note

Spawning a Go routine may be a possible source of non-determinism
totalDuration = stats[k].Duration
}
}
rps := float64(totalReqs) / totalDuration.Seconds()

Check notice

Code scanning / CodeQL

Floating point arithmetic Note

Floating point arithmetic operations are not associative and a possible source of non-determinism
Kbhat1 added 2 commits March 3, 2026 08:52
Each RPC method is defined once in a single registry slice. Phases
derive from heavy/light classification. Adding a new method is one
line. Use -methods flag to run a subset.

Made-with: Cursor
Traces a configurable number of txs (-trace-discover, default 5) during
discovery to extract real (address, slot) pairs. eth_getStorageAt now
queries actual populated slots instead of random ones. Falls back to
random slots when discovery is disabled or finds nothing.

Made-with: Cursor
Comment on lines +179 to +181
for addr := range addrSet {
info.Addresses = append(info.Addresses, addr)
}

Check warning

Code scanning / CodeQL

Iteration over map Warning

Iteration over map may be a possible source of non-determinism
Comment on lines +441 to +443
for k, v := range s {
lightStats[k] = v
}

Check warning

Code scanning / CodeQL

Iteration over map Warning

Iteration over map may be a possible source of non-determinism
Comment on lines +161 to +169
for addr, acct := range prestate {
for slot := range acct.Storage {
key := addr + "|" + slot
if !seen[key] {
seen[key] = true
slots = append(slots, storageSlot{Address: addr, Slot: slot})
}
}
}

Check warning

Code scanning / CodeQL

Iteration over map Warning

Iteration over map may be a possible source of non-determinism
Comment on lines +162 to +168
for slot := range acct.Storage {
key := addr + "|" + slot
if !seen[key] {
seen[key] = true
slots = append(slots, storageSlot{Address: addr, Slot: slot})
}
}

Check warning

Code scanning / CodeQL

Iteration over map Warning

Iteration over map may be a possible source of non-determinism
if err != nil {
return nil, elapsed, err
}
defer resp.Body.Close()
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: fix lint

Kbhat1 added 2 commits March 4, 2026 08:05
Phase 1 now traces every discovered block once and prints a table:
  BLOCK         TXS     LATENCY
  196571121     97      2.5s
  196571111     1       120ms

Made-with: Cursor
}
avgGasPerTx := 0.0
if len(info.Transactions) > 0 {
avgGasPerTx = float64(info.GasUsed) / float64(len(info.Transactions))

Check notice

Code scanning / CodeQL

Floating point arithmetic Note

Floating point arithmetic operations are not associative and a possible source of non-determinism
}
avgGasPerTx := 0.0
if len(b.Transactions) > 0 {
avgGasPerTx = float64(b.GasUsed) / float64(len(b.Transactions))

Check notice

Code scanning / CodeQL

Floating point arithmetic Note

Floating point arithmetic operations are not associative and a possible source of non-determinism
@Kbhat1 Kbhat1 changed the title [WIP] EVM RPC read benchmark script for state store load testing EVM RPC read benchmark script for state store load testing Mar 13, 2026
This keeps the benchmark workload aligned with the selected methods, avoids extra hidden trace work, and fixes concurrent random request selection.

Made-with: Cursor
Kbhat1 added 4 commits March 17, 2026 21:32
Resolve the go.mod conflict by keeping main's shared dependency updates and preserving rpc_bench's x/image dependency so the benchmark tool still builds.

Made-with: Cursor
Check file-handle and parse errors explicitly and tighten plot path handling so golangci-lint passes on the benchmark tool.

Made-with: Cursor
Drop the unused x/exp typeparams entry and stale x/text checksums so go mod tidy stays clean on the benchmark branch.

Made-with: Cursor
@Kbhat1 Kbhat1 enabled auto-merge March 18, 2026 03:30
@Kbhat1 Kbhat1 added this pull request to the merge queue Mar 18, 2026
Merged via the queue into main with commit 8e94eb5 Mar 18, 2026
38 checks passed
@Kbhat1 Kbhat1 deleted the kartik/ss-read-benchmark branch March 18, 2026 03:59
yzang2019 pushed a commit that referenced this pull request Mar 19, 2026
- Adds an EVM RPC read benchmark tool for e2e node debug_trace and
state-store load testing

- Hits heavy trace endpoints plus common state reads, including
`eth_getLogs`, and reports latency/RPS across per-method and mixed
workloads

- Includes lightweight per-block trace summaries and optional PNG plots
to help spot trace performance patterns.

- Verified fully on node

Example:

<img width="1400" height="900" alt="latency_vs_gas"
src="https://github.com/user-attachments/assets/4a46bd97-fef6-49e4-b87d-85c48e253c56"
/>
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