Skip to content

Transport Benchmarks

Transport benchmarks live under benchmarks/transport. They measure the public Event and Control surfaces before timed-execution metadata is added.

Installed-User Flow

  1. Install R2Kernel under /opt/r2kernel.
  2. Source /opt/r2kernel/env.sh.
  3. Run benchmark commands from /opt/r2kernel.

The runners can start the installed control backend when one is not already available. Run one benchmark at a time on a host so concurrent runners do not distort latency or loss measurements.

Every accepted report should record these conditions.

  • R2Kernel release and host architecture
  • same-host or cross-host topology
  • payload size, period, sample count, and warmup count
  • publisher and subscriber language
  • subscriber or connection count
  • host load and time-sync acceptance when one-way cross-host latency is used
  • raw JSON result, warnings, and summary

Coverage

Benchmark Purpose
transport/event Event publish/subscribe latency, fanout, and observed drops
transport/control Control request/response latency, timeout behavior, and priority contention

Event

Path: benchmarks/transport/event

Quick Python validation.

python3 benchmarks/transport/event/run_benchmark.py \
  --publisher-language python \
  --subscriber-language python \
  --count 20 \
  --warmup 5

Representative C++ validation.

python3 benchmarks/transport/event/run_benchmark.py \
  --publisher-language cpp \
  --subscriber-language cpp \
  --count 100 \
  --warmup 10

For high-rate validation, make workload controls explicit.

python3 benchmarks/transport/event/run_benchmark.py \
  --publisher-language cpp \
  --subscriber-language cpp \
  --payload-size 8 \
  --period-us 1000 \
  --count 10000 \
  --warmup 1000 \
  --queue-depth 64 \
  --fail-on-warning

dropped is a measured result. A normal exploratory run can complete while reporting drops. Use --fail-on-warning when nonzero drops, missing measured samples, or other warnings must fail CI or release validation. Queue depth is a workload setting, not a reliability guarantee. Event should not be used as a reliable control-command surface.

Cross-host one-way results are valid only after both time synchronization and the exact Event route are ready. Otherwise, use round-trip measurements or mark the result as diagnostic.

Control

Path: benchmarks/transport/control

Quick Python validation.

python3 benchmarks/transport/control/run_benchmark.py \
  --controller-language python \
  --gateway-language python \
  --count 20 \
  --warmup 5

Representative C++ validation.

python3 benchmarks/transport/control/run_benchmark.py \
  --controller-language cpp \
  --gateway-language cpp \
  --count 100 \
  --warmup 10

Priority-contention validation.

python3 benchmarks/transport/control/run_priority_benchmark.py \
  --controller-language python \
  --gateway-language python

The Control runner follows the same result, warnings, summary, and --fail-on-warning convention as the Event runner.

Reference Results

These values come from Ubuntu sandbox measurements. They are sizing references, not universal acceptance limits. Re-run the public benchmark commands on the target robot hardware before making a deployment decision.

Track Mode Condition Reference result
Event 1:N fanout same-host 64 B-4 KiB, N=1/2/4/8/16, 1000 Hz lossless, subscriber mean 23.413-39.963 us
Event 1:N fanout cross-host 64 B-4 KiB, N=1/2/4/8/16, 1000 Hz lossless, subscriber mean 116.631-175.347 us
Event 1:N stress cross-host 8 B, N=512, 1000 Hz lossless in the measured sandbox, subscriber mean about 541 ms
Event 1:N stress cross-host 8 B, N=1024, 1000 Hz 1008/1024 endpoints completed in the measured sandbox
Event RTT same-host 64 B-64 KiB, 10000 samples ping average 43.125-115.346 us, failures 0
Event RTT cross-host 64 B-64 KiB, 10000 samples ping average 239.061-479.578 us, failures 0
Control same-host C++ 8 B, 1 kHz average 82.174 us, p95 99.097 us, failures 0
Control cross-host C++ 8 B, 1 kHz average 383.970 us, p95 793.900 us, failures 0
Control cross-host C++ 1 MiB, about 30 Hz average 14.890 ms, p95 16.038 ms, failures 0

The N=512 and N=1024 rows are capacity observations, not supported acceptance targets. Cross-host one-way rows assume accepted clock evidence and route readiness. Preserve warning and environment data when publishing derived results.

C++ Toolchain Note

Installed R2Kernel C++ SDK artifacts include the dependencies needed by the normal installed-user benchmark path. A compiler toolchain and development dependency packages are needed only when rebuilding the public C++ SDK source.

Relationship To Tutorials

Use Add Component Subsystems for a runnable communication example. Use these benchmark runners for reproducible latency, fanout, loss, and contention measurements.