Skip to content

Add solbench methods: per-method read-latency matrix (roadmap 6) - #1

Open
jenish-25 wants to merge 4 commits into
rpc-edge:mainfrom
jenish-25:feat/methods-matrix
Open

Add solbench methods: per-method read-latency matrix (roadmap 6)#1
jenish-25 wants to merge 4 commits into
rpc-edge:mainfrom
jenish-25:feat/methods-matrix

Conversation

@jenish-25

Copy link
Copy Markdown

Summary

Ships the first piece of roadmap item 6: a per-method read-latency matrix via a new
solbench methods subcommand. Today probe measures one hardcoded method (getSlot); this
measures a set of read methods across every endpoint and reports a latency distribution per
(method × endpoint).

Motivation: different RPC methods carry different server-side cost, so a matrix lets you compare
endpoints within a method and see relative method cost — an honestly-labeled distribution
metric, which CONTRIBUTING.md calls out as especially welcome.

What's included

  • solbench methods --samples N --interval-ms M [--account <pubkey>] [--json] — measures
    getSlot, getVersion, getLatestBlockhash, getAccountInfo, getMultipleAccounts.
  • Reuses the fair sampler. The open-loop, coordinated-omission-correcting tick loop is
    extracted from probe.rs::run_endpoint into a shared sample_endpoint(...), so probe and
    methods measure identically. getSlot/slot-lag behavior is preserved exactly (a thin
    extract closure), and probe_all/ProbeResult are unchanged.
  • Provider-neutral, reproducible params. The account-reading methods hit canonical Solana
    sysvars (Clock / Rent / RecentBlockhashes), which exist on any cluster; --account overrides the
    getAccountInfo target.
  • Honest labeling. Output footer states the numbers are network-inclusive round-trips from THIS
    host, to compare endpoints within a method (not across), that methods run in sequence, and
    which fixed accounts are used.
  • solbench-core is untouched — no new math there, so the "keep core network-free" rule holds.

Example

method               endpoint         host                          p50ms    p99ms   jitter    ok
getSlot              public mainnet   api.mainnet-beta.solana.com   663.34   765.15    51.40   3/3
getVersion           public mainnet   api.mainnet-beta.solana.com   766.48   880.46    84.40   3/3
getLatestBlockhash   public mainnet   api.mainnet-beta.solana.com   786.44  1838.29   500.97   3/3
getAccountInfo       public mainnet   api.mainnet-beta.solana.com   770.34   811.45    19.83   3/3
getMultipleAccounts  public mainnet   api.mainnet-beta.solana.com   655.33   752.42    45.92   3/3

--json emits [{ "method", "results": [{ "label", "host", "ok", "errors", "latency" }] }].

Testing

cargo fmt --all --check, cargo clippy --all-targets --all-features -- -D warnings, and
cargo test --all all pass locally. New tests use a hermetic tiny_http server (no live network):

  • sample_endpoint records latency + extracts values, and counts malformed responses as errors;
  • probe_methods produces a per-method report with latency;
  • method_specs are well-formed JSON with the right method/params;
  • methods_extract distinguishes result vs error.

Notes

  • Public endpoints may rate-limit under high --samples across five methods; defaults are modest.
  • Scope is intentionally the matrix only; HDR histograms (also under roadmap 6) are left as a
    separate change. Happy to adjust the method set, output columns, or naming to your preferences.

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.

1 participant