Skip to content

Server P10a: measure the Live quote rate over 1, 16 and 256 instruments - #159

Merged
sujitn merged 1 commit into
mainfrom
server-p10a-throughput
Oct 26, 2026
Merged

sujitn merged 1 commit into
mainfrom
server-p10a-throughput

Conversation

@sujitn

@sujitn sujitn commented Oct 26, 2026 •

Copy link
Copy Markdown
Owner

Summary

P10a measures the Live quote rate (D53). It adds benchmarks and one test, and changes no behaviour.

  • runtime_benchmarks.rs:
    • live_throughput/{1,16,256}: a Live plan of N bonds (copies of the fixture bond under new identities, each with its own quote key) takes bursts of 64 quotes through a 1,024-event source shaped like the server's QuoteIngress. Each sample waits for the result of the burst's last quote.
    • snapshot/assemble/{1,16,256}: one snapshot over N instruments (configuration and reference reads, quote ingestion, content hash).
  • live_ingress.rs::an_offered_rate_above_the_drain_rate_is_refused_with_429_and_nothing_is_lost: 256-event batches posted faster than the runtime drains end in 429 CAPACITY_EXCEEDED (retryable). The runtime then values every accepted quote and stays ready.

Numbers

Medians, ci profile, WSL2, 24 vCPU, rustc 1.97.1:

Instruments Quotes/s Time per quote (one tick) snapshot/assemble
1 3,467 0.29 ms 33 µs
16 543 1.84 ms 324 µs
256 33.7 29.7 ms 4.70 ms

Every quote revalues every instrument (G21), so the rate falls roughly as 1/N. Against the 10k quotes/s target, 256 instruments reach 34.

Stage split of one tick at 256 instruments (a throwaway probe with the /metrics histograms installed; not committed):

Stage ms
snapshot_assemble 4.8
curve_build{graph} (verify + build of the 256-instrument snapshot) 2.0
calculate (256 valuations on four threads, in awaited chunks of four) 15.8
valuation CPU (110 µs each, against 82 µs for one bond alone) 28.0
publish 0.03
Remainder (accept, checkpoint and result clones, health) about 6.5
Tick 29.2

What the numbers decide (recorded in the plan)

  • D55 is in scope, by the approved trigger. One 256-instrument tick carries 28 ms of valuation CPU: about 1.2 ms even spread perfectly over this box's 24 vCPU. The serial stages D54 and D56 leave in place (the snapshot hash inside assemble, and the 2 ms verify and build at graph activation) add to that. Only valuing fewer instruments per tick brings it under 1 ms.
  • Conflation (D54) alone should reach 10k quotes/s at 256 instruments (about 300 quotes per 29 ms tick, within the 1,024 bound), at one to two ticks of latency.
  • New findings:
    • G24 (needs a decision): data quality is one value for the whole snapshot. MarketSnapshot quality is derived from the issues of every quote, curve and fixing, and worker::value fails every instrument when it is not Valid. So one bond's stale or missing quote fails every result in the plan. Cross-quote source skew is the instance the 256-bond bench hit: the one-bond fixture allows 1 s, and the bonds ticked apart (the bench now uses the compiled Live value, 10 minutes). The decision is per-instrument quality (each result judged on the inputs it consumed) or the current snapshot-wide rule.
    • G25: per-instrument lookups scan every reference, quote and result by id, which makes a tick O(N²). An index removes them.
    • G26: calculate awaits each chunk of max_concurrent_calcs jobs before spawning the next.
    • G27: accept and calculate clone the whole checkpoint, results and outbox, on every tick.
  • Proposed P10b order: D54 conflation → G25 index and G26 one job per batch → D56 frozen inputs with G27 → D55 → G24 once decided.

Verification

  • WSL: tools/assurance/check.py passed; clippy -D warnings on the engine and server (all targets) passed; the live_ingress tests pass (3 of 3). The only cargo fmt --check finding was one import's order in the bench, fixed before this commit.
  • Native Windows: live_ingress passes. The new bench cases pass in criterion test mode.

🤖 Generated with Claude Code

…nds in 429

runtime_benchmarks gains live_throughput/{1,16,256} (bursts of 64 quotes
over N fixture bonds, through a 1,024-event source shaped like the
server ingress) and snapshot/assemble/{1,16,256}. live_ingress gains an
end-to-end test: quotes offered faster than the runtime values them end
in 429 CAPACITY_EXCEEDED, and every accepted quote is still valued.
No behaviour change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 5d25e6da-3c0b-4e49-b117-d07faed33f13
Commits

Reviewing files that changed from the base of the PR and between cbb5f75 and 26e9349.

Files selected for processing: 2
  • crates/convex-engine/benches/runtime_benchmarks.rs
  • crates/convex-server/tests/live_ingress.rs

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

Walkthrough

The benchmark suite adds Live quote-throughput and snapshot-assembly measurements for plans with 1, 16, and 256 instruments. The Live ingress tests now include a capacity case that checks retryable rejection and runtime progress for accepted quotes.

Changes: Live runtime benchmarks

Layer / File(s) Summary
Benchmark runtime and fixtures
crates/convex-engine/benches/runtime_benchmarks.rs
The Live engine helper now accepts an explicit runtime plan and quote source. New fixtures and quote-source helpers support plans with 1, 16, and 256 instruments.
Throughput and assembly measurements
crates/convex-engine/benches/runtime_benchmarks.rs
Criterion now measures repeated 64-quote bursts and snapshot assembly across the configured widths. The throughput benchmark checks complete results, and the assembly benchmark checks the initial reference count.

Live ingress capacity test

Layer / File(s) Summary
Ingress setup and capacity behavior
crates/convex-server/tests/live_ingress.rs
A shared setup prepares the Live runtime fixture. The new capacity test checks for a retryable CAPACITY_EXCEEDED response and verifies that accepted quotes advance runtime generations while the runtime remains ready and failure-free.

Priority: Low

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Other

Possibly related PRs

  • sujitn/convex#139: Adds the quote-ingress capacity response exercised by the new overload test.
  • sujitn/convex#147: Changes the Live input to use an explicit QuoteSource, which this PR passes to the benchmark engine helper.
  • sujitn/convex#157: Updates the runtime benchmark path that this PR extends with throughput and snapshot-assembly measurements.
Merge Risk: Minimal · up to 26e93

The new benchmarks and capacity test have no identified issue that needs resolution before merge.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 42.11% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 19 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly describes the primary change: adding Live quote-rate measurements for 1, 16, and 256 instruments. It is concise and specific. It does not mention the additional overload test, but th…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title clearly describes the primary change: adding Live quote-rate measurements for 1, 16, and 256 instruments. It is concise and specific. It does not mention the additional overload test, but the title does not need to cover every change.

Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@sujitn
sujitn merged commit dbb7ee1 into main Oct 26, 2026
16 checks passed
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