Run the y-openrtc Local Benchmark
Measure Yjs sync latency, convergence, and reconnect time on your own machine, and read the results without over-claiming.
Run the y-openrtc Local Benchmark
This benchmark answers one small question: on this machine, how quickly do
YProvider editors converge, and how quickly do they recover after one editor
drops off and returns?
It is a local-only measurement. It does not use the network, a relay, QUIC, the Rust runtime, or the coordination gateway, so it says nothing about capacity, scale, or real-world network latency. Use it to compare your own before/after changes, not to promise performance to anyone.
Run it
From a checkout of the OpenRTC repository:
pnpm install
pnpm --filter y-openrtc bench
The default run takes about 20 seconds and prints one JSON report. To keep a copy:
pnpm --filter y-openrtc bench -- --out bench.json
The command exits non-zero if any scenario fails to converge, so it is safe to use in a script.
Change the workload
Every option accepts a single value or a comma-separated list. A list runs every combination.
| Option | Meaning | Default |
|---|---|---|
--doc-bytes | Initial document size in bytes | 1024,1048576 |
--editors | Concurrent editors (2 or more), each a YProvider | 2,4 |
--rate | Edits per second, per editor | 20 |
--duration | Seconds of steady editing per scenario | 3 |
--offline-edits | Edits made on each side while editor 0 is disconnected | 10 |
--timeout-ms | How long to wait for convergence in each phase | 10000 |
--out | Also write the JSON report to a file | none |
pnpm --filter y-openrtc bench -- --doc-bytes 65536 --editors 3 --rate 50
What it does
For each scenario the benchmark:
- Creates the editors, each with its own
Y.DocandYProvider, joined by an in-process fake OpenRTC runtime in a full mesh. - Seeds editor 0 with a document of the requested size and waits for every editor to match (initial sync).
- Has every editor make small timed inserts at the requested rate (steady phase) and records how long each edit takes to reach each other editor.
- Disconnects all of editor 0's links, makes edits on both sides, restores the links, and times how long until every document is identical (reconnect).
Read the results
The report has three parts: where it came from, what was run, and what was measured.
| Field | What it tells you |
|---|---|
scope, capacityClaims | Reminder that this is local-only with no capacity claim |
source | Git commit, branch, and whether the tree had uncommitted changes (dirty) |
sdk | y-openrtc, openrtc, yjs, and y-protocols versions |
environment | Node version, platform, and CPU |
topology, workload, routeEvidence | What was and was not exercised |
results[].config | Document size, rate, editors, duration, and offline edits |
results[].latencyMs | p50, p95, p99, min, max of edit-to-observed time across every sender and receiver pair |
results[].steady | Edits sent, achieved rate, and delivered vs. expected counts |
results[].initialSyncMs | Time for the first full sync |
results[].reconnect.reconnectToConvergenceMs | Time from restoring links to identical documents |
results[].converged | true only if every phase converged and every edit was delivered |
Tips for reading it:
converged: falseis the headline. Checkfailuresfor which phase broke.- Compare
p95andp99, not onlyp50. Tail latency shows pauses that the median hides. achievedEditsPerSecondPerEditorshould be close to--rate. If it is much lower, the machine could not keep up and the latencies are skewed.- Compare like with like. Only compare reports with the same
config,environment, and a clean (dirty: false)source. - Run it more than once. Single runs on a laptop are noisy.
What the numbers do not mean
Latencies here are sub-millisecond-to-low-millisecond because nothing crosses a network. They measure Yjs encoding/merging and the provider's message handling. Real deployments add route setup, relay or direct-path latency, and packet loss. This benchmark makes no capacity, concurrency-limit, or production-latency claim.