Test system
v3.2.0 (commit 38ec5fe)Constrained hardware (8-year-old ultrabook) deliberately used for reproducibility. Production deployments on EPYC/Xeon will see lower absolute latencies due to higher clock speeds and larger caches. The architecture and relative costs remain identical; only absolute numbers scale.
What's measured: native ABI vs. cgo
Reamer Server can be deployed two ways. Both are measured separately here.
Native C++ ABI — pure vtable calls, no socket I/O
A C++ or Rust customer links libreamer_server_core directly into their own process and calls gate and broker functions through a vtable of function pointers. This measurement isolates the cost of the ABI boundary itself — the indirect function call and struct marshaling overhead — with no socket layer, no Go/C boundary crossing, no I/O.
cgo reference implementation — end-to-end with socket I/O
The Go-via-cgo reference gate and broker connectors include socket communication to strategy clients (on localhost, no network round trip). This measures the real-world cost a customer sees when using the reference implementation as-is: socket I/O, Go/C boundary crossing, server core processing, and ack transmission all combined.
Native C++ ABI: vtable call overhead
How much latency does the core cost you? Headline: 30 nanoseconds. P50: 0.03µs
| Percentile | Latency (µs) | Latency (ns) |
|---|---|---|
| P50 | 0.03 | 30 |
| P90 | 0.03 | 30 |
| P99 | 0.07 | 70 |
| P99.9 | 0.08 | 80 |
| Mean | 0.03 | 30 |
| Max | 0.013 | 13,080 |
Pure vtable calls through the C ABI are nearly free. The customer's own gate and broker logic dominates the cost, not the boundary crossing. Total aggregate throughput: approximately 4.0 million vtable calls per second.
cgo reference implementation: end-to-end latency
Real-world integration path latency (socket + Go/C boundary + core). P50: 23µs · P99: 69µs
| Percentile | Latency (µs) |
|---|---|
| P50 | 23.09 |
| P90 | 39.98 |
| P99 | 69.08 |
| P99.9 | 106.93 |
| Mean | 27.64 |
| Max | 3,215.98 |
Breakdown of the 27.64µs mean latency
- Pure ABI vtable call overhead: 0.03µs
- Go/C boundary crossing (stack switch and marshaling): 1-2µs
- Server core processing (sequencer, event bus, monitoring): 5-10µs
- Socket I/O (localhost UDS round trip to strategy client): 15-20µs
Socket I/O and Go/C boundary crossing dominate the end-to-end cost. The core's own contribution is less than 1 microsecond.
Throughput and consistency
Measured across 4 concurrent strategy clients, 50,000 orders per client, 3 independent runs (600,000 total samples): aggregate throughput 156,250 orders per second. Variance is stable: P99 across runs ranges 58-88µs, a 1.51x ratio indicating predictable behavior.
Latency spectrum in context
These numbers don't exist in a vacuum. Here is where Reamer Server sits in the execution latency spectrum of quantitative trading:
| Tier | Latency | Scope |
|---|---|---|
| High-frequency trading (HFT) | <1 microsecond | Pure hardware and kernel scheduling |
| Reamer Server native ABI | 30 nanoseconds | Core-only vtable overhead |
| Reamer Server cgo reference | 23-69 microseconds (P50/P99) | Core + socket I/O + boundary crossing |
| Institutional EMS and network | 1-10+ milliseconds | Venue round trip, exchange processing |
Reamer Server's 69µs P99 becomes a 1-2% contributor to overall latency in real institutional execution flows. The venue round trip dominates the end-to-end budget; Reamer Server's core contribution is negligible by comparison.
Scope and methodology
Core-to-local-acceptor latency only: These benchmarks measure Reamer Server's contribution to the execution path in isolation. They explicitly do not include:
- Network round trip (wire propagation delay)
- Venue or exchange processing time
- Real market data feed latency
Socket communication in the cgo measurements uses localhost UDS only — no actual network crossing. This reflects the latency that Reamer Server core itself contributes. A real deployment's end-to-end latency includes these external factors (typically 1-10ms+ for venue round trips), which dwarf the 25-70µs core contribution.
Test configuration
- cgo benchmark: 4 concurrent strategy clients (Go goroutines), 50,000 orders per client, 3 independent runs, back-to-back (zero inter-send delay) burst load
- Native ABI benchmark: Direct C++ vtable calls to gate and broker functions, same workload pattern as cgo (4 x 50,000 x 3 iteration), measuring pure boundary cost
- CPU pinning: Server pinned to core 0, clients on cores 1-3, to eliminate cross-core migration overhead and reduce cache-line contention (best-case latency scenario)
Reading these numbers honestly
- The headline 30ns ABI overhead is not a competitive claim. It's a measurement of how little latency the core itself costs you — the rest of the execution stack is your responsibility. A C++ customer linking the ABI directly will see these numbers. A cgo customer will see the full 27.64µs, dominated by socket I/O and boundary crossing.
- Throughput (156,250 orders/sec aggregate) is observed real throughput, not theoretical headroom. Socket I/O is the bottleneck, not gate or broker logic.
- These measurements use constrained hardware (8th-gen ultrabook CPU). Production deployments on newer server CPUs will see lower absolute latencies but identical relative costs.
- Outliers (212 of 600,000 samples at >230µs, max 3.2ms) are OS scheduling artifacts under burst-load, pinned-CPU conditions. Real event-driven workloads (millisecond-spaced strategy events) will see lower variance.
- Measured core-to-local-acceptor scope only. Your end-to-end latency includes venue communication, which typically dominates. Reamer Server's 69µs P99 contribution becomes a minor (1-2%) component in institutional execution flows.
reamer-server/BENCHMARK.md.