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.

OptionMeaningDefault
--doc-bytesInitial document size in bytes1024,1048576
--editorsConcurrent editors (2 or more), each a YProvider2,4
--rateEdits per second, per editor20
--durationSeconds of steady editing per scenario3
--offline-editsEdits made on each side while editor 0 is disconnected10
--timeout-msHow long to wait for convergence in each phase10000
--outAlso write the JSON report to a filenone
pnpm --filter y-openrtc bench -- --doc-bytes 65536 --editors 3 --rate 50

What it does

For each scenario the benchmark:

  1. Creates the editors, each with its own Y.Doc and YProvider, joined by an in-process fake OpenRTC runtime in a full mesh.
  2. Seeds editor 0 with a document of the requested size and waits for every editor to match (initial sync).
  3. 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.
  4. 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.

FieldWhat it tells you
scope, capacityClaimsReminder that this is local-only with no capacity claim
sourceGit commit, branch, and whether the tree had uncommitted changes (dirty)
sdky-openrtc, openrtc, yjs, and y-protocols versions
environmentNode version, platform, and CPU
topology, workload, routeEvidenceWhat was and was not exercised
results[].configDocument size, rate, editors, duration, and offline edits
results[].latencyMsp50, p95, p99, min, max of edit-to-observed time across every sender and receiver pair
results[].steadyEdits sent, achieved rate, and delivered vs. expected counts
results[].initialSyncMsTime for the first full sync
results[].reconnect.reconnectToConvergenceMsTime from restoring links to identical documents
results[].convergedtrue only if every phase converged and every edit was delivered

Tips for reading it:

  • converged: false is the headline. Check failures for which phase broke.
  • Compare p95 and p99, not only p50. Tail latency shows pauses that the median hides.
  • achievedEditsPerSecondPerEditor should 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.