Skip to main content

libatbus-go Benchmark

Scope: Communication Library Benchmark Only

This page measures only the Go communication library libatbus-go (full v2 protocol stack). It does not represent end-to-end application RPC performance in atsf4g-go services.

Real business RPCs built on atsf4g-go add layers above libatbus-go:

  • Dispatch and concurrency control: libatapp-go worker-pool dispatch, Dispatcher unpacking, and ActorExecutor token queuing and handoff (see Go Framework (In Progress));
  • Richer RPC headers and routing: business RPC framing, router object lookup and forwarding, service discovery, and multi-hop atproxy forwarding;
  • Observability and storage: logging, telemetry, domain logic, and Redis or external I/O.

Therefore, actual business RPC throughput and QPS will be lower than these communication-library baselines. Use this report to evaluate Go transport ceilings, cipher and compression costs, GOGC / GOMEMLIMIT tuning, memory breakdown, same-host transport gains, and order-of-magnitude differences against C++ libatbus (see libatbus Benchmark).

Background​

libatbus-go is the Go implementation of the atframework inter-server communication bus, aligned with the C++ libatbus v2 protocol stack (framing, Protobuf, handshake, X25519 key exchange, encryption, and compression). Measurements were collected on the same dedicated Linux host used for the C++ libatbus benchmark plus a Windows workstation, reusing the same payload generator and aggregation rules across cross-platform TCP baselines, single-core pinned runs (GOMAXPROCS=1), GOGC=800 comparisons, Unix domain sockets, 2-to-1000-node fan-in, and high-connection receiver and zstd sender memory diagnostics.

Full reproduction commands and all expanded tables live in atframework/libatbus-go/docs/Benchmark.md inside atsf4g-go and in the GitHub benchmark report.

Key Results​

The table below summarizes unencrypted, uncompressed ceilings (1 KB = 1024 B, 1 MB = 1024 KB, 1 GB = 1024 MB) alongside same-host C++ libatbus numbers:

ScenarioChannel / Mode200 B (QPS / Throughput)1 KB (QPS / Throughput)8 KB (QPS / Throughput)64 KB (QPS / Throughput)300 KB (QPS / Throughput)
Linux (single pair)TCP, default919.2K / 175.3 MB/s597.4K / 583.4 MB/s207.0K / 1.58 GB/s30.0K / 1.83 GB/s6.7K / 1.91 GB/s
Linux (single pair, pinned)TCP, GOMAXPROCS=1 each897.4K / 171.2 MB/s551.9K / 538.9 MB/s150.4K / 1.15 GB/s27.2K / 1.66 GB/s6.4K / 1.83 GB/s
Linux (single pair, GOGC=800)TCP992.7K / 189.3 MB/s651.8K / 636.5 MB/s212.1K / 1.62 GB/s33.8K / 2.07 GB/s7.8K / 2.24 GB/s
Linux (single pair)unix://966.2K / 184.3 MB/s612.8K / 598.4 MB/s211.3K / 1.61 GB/s30.7K / 1.87 GB/s7.4K / 2.12 GB/s
Windows (single pair)TCP, default911.6K / 173.9 MB/s541.2K / 528.6 MB/s77.2K / 602.8 MB/s13.2K / 823.8 MB/s1.4K / 401.0 MB/s
Linux (10-node fan-in)TCP, CPU-pinned1.41M / 268.5 MB/s1.10M / 1.05 GB/s349.4K / 2.67 GB/s94.1K / 2.87 GB/s (32 KB)10.3K / 2.95 GB/s
Linux (1000-node fan-in)TCP, CPU-pinned1.14M / 217.9 MB/s888.6K / 867.8 MB/s223.7K / 1.71 GB/s65.7K / 2.00 GB/s (32 KB)8.5K / 2.43 GB/s
C++ Linux (single pair, same host)TCP, mimalloc3.66M / 697.5 MB/s1.65M / 1.58 GB/s302.0K / 2.30 GB/s42.7K / 2.60 GB/s9.6K / 2.76 GB/s
C++ Linux (1000 nodes, same host)TCP, mimalloc3.70M / 706.6 MB/s1.39M / 1.33 GB/s243.6K / 1.86 GB/s73.2K / 2.23 GB/s (32 KB)9.4K / 2.70 GB/s

Each C++ side saturates one core, whereas the default, GOGC=800, and multi-node Go rows use multiple cores. Compare strictly single-core numbers via the pinned row and the CPU-normalized breakdown below.

Recommended deployment settings:

Deployment scenarioRecommended channel & algorithmsRuntime & notes
Linux cross-host intranet (high throughput)TCP + AES-128-GCM or AES-256-GCM, no compressionRaise GOGC to 400–800 (or pair with GOMEMLIMIT) on throughput-critical nodes; AES-GCM costs 25%–39%, and tuning GOGC recovers 12%–26% on large payloads
Bandwidth-constrained WANTCP + snappy or lz4 with AES-GCMsnappy is ~20% faster than lz4 with a slightly better ratio; do not enable zstd or zlib until per-message encoder allocation is fixed (each zstd sender holds ~24 MB private RAM, requiring GOMEMLIMIT at high sender counts)
Linux same-host IPCTCP or unix://, encrypt as neededGo does not implement shm://; unix:// gains only 2%–5% over TCP, so choose by deployment convenience
Central fan-in receiver (~1000 senders)TCP + AES-128-GCM, no compression or snappyDedicate 3–4 CPU cores to the receiver and pin senders (GOMAXPROCS=1) to remaining cores; set receiver GOMEMLIMIT above the live heap (~700 MB at 1000 nodes / 300 KB, e.g. 1GiB) to avoid 1.3 GB RSS without causing GC thrashing below live heap; keep default GOGC on large sender fleets
Disallowed in productionDisable raw ChaCha20Provides no authentication tag. In the Linux benchmarks without compression, throughput was 47%–84% lower than plaintext and 20%–69% lower than ChaCha20-Poly1305

Test Environment and Method​

Runs used libatbus-go 7376c60 with node-layer performance optimizations, built standalone (GOWORK=off) with Go 1.27.4 and static linking (CGO_ENABLED=0):

ItemDedicated Linux Host (same as C++ report)Native Windows
RuntimeProxmox LXC container, Debian 13.7, 24 GB RAM (no swap)Windows 11 Pro (build 26300), 125.1 GB RAM, active desktop
CPUAMD Ryzen 9 9950X host, 12 online logical CPUs (0–11)AMD Ryzen 9 9950X3D, 32 logical CPUs
Toolchain & buildgo1.27.4 (GOOS=linux GOARCH=amd64 CGO_ENABLED=0 -trimpath)go1.27.4 native build
Default runtimeGOGC=100, GOMAXPROCS=12 (except GC, single-core, and memory-diagnostic groups)GOGC=100, GOMAXPROCS=32
Key dependenciesprotobuf v1.36.11, x/crypto v0.47.0, klauspost/compress v1.17.10, pierrec/lz4 v4.1.22, golang/snappy v0.0.4Same

Test matrix and measurement rules:

  • Matrix: single-pair TCP covers 22 cipher/compression combinations × 5 payload sizes (110 runs each on Linux and Windows, 15 s per run); same-host IPC tests unix:// (5 plaintext runs); GOGC=800 (30 runs) replaces the C++ allocator comparison; single-core pinned (GOMAXPROCS=1 per side, 30 runs) mirrors C++'s single-threaded loop; multi-node fan-in covers 2 / 10 / 100 / 1000 nodes × 20 combinations × 6 payload sizes (480 runs, 467 valid, 10 s per run); additional 30–90 s Linux memory-diagnostic and heap-profiling runs inspect receiver memory (1000 nodes, 2 nodes, and 3 connect/disconnect cycles) and zstd sender memory (300 / 600 / 1000 nodes vs plaintext and zlib, unarchived).
  • Flow control and payloads: single-pair runs use real ctrl + data dual connections. Because libatbus-go limits its send queue by frame count (1024), the harness derives an in-flight message cap from the byte budget so 300 KB backpressure matches C++. Payloads use the same fixed-seed JSON-like text generator as C++; encrypted sessions use X25519 + HKDF-SHA256 with the default 3-hour key refresh (no renegotiation during runs).
  • Metrics and variance: QPS and payload throughput count raw application bytes delivered at the receiver, excluding the first 2 s warmup and trailing samples after the first connection closes, aggregated by duration-weighted median. Process CPU (100% = 1 core; Go processes can exceed 100%), GC CPU share (/cpu/classes/gc/total:cpu-seconds), and peak RSS are also recorded. Differences within 10% on Linux (20% for GC-heavy zstd/zlib, with ~10% run-to-run zstd variance) or 25% on Windows desktop are treated as noise.

Cross-Platform Baseline and C++ Comparison​

Cross-Platform TCP Baseline and Single-Core Comparison​

Unencrypted, uncompressed TCP loopback QPS and throughput for libatbus-go (Linux default, single-core, GOGC=800, Windows) and same-host C++ libatbus (mimalloc)

Unencrypted, uncompressed IPv4 TCP loopback. Top: QPS on a logarithmic scale; bottom: payload throughput on a linear scale.

Under default Linux settings, libatbus-go reaches 919.2K msg/s (175.3 MB/s) at 200 B and 1.91 GB/s (6.7K msg/s) at 300 KB. At <= 1 KB, sender CPU dominates (framing, checksum, queueing); from 8 KB upward, receiver CPU dominates (reads, checksum, decoding, and GC). Windows matches Linux within 10% on small packets (911.6K vs 919.2K at 200 B) but falls to 21%–44% of Linux from 8 KB onward (receiver GC CPU reaches 89% at 64 KB vs 48% on Linux; root cause unconfirmed).

Same-host Linux comparison between libatbus-go (default multi-core, single-core pinned, and normalized by the busier side's CPU) and single-core C++ libatbus (mimalloc):

PayloadC++ 1-core QPS / ThroughputGo default QPS / Throughput (recv / send CPU)Default Go / C++Pinned 1-core Go QPS (Go / C++)Busier-side 1-core normalized Go / C++
200 B3.66M / 697.5 MB/s919.2K / 175.3 MB/s (103% / 131%)25%897.4K (25%)19%
1 KB1.65M / 1.58 GB/s597.4K / 583.4 MB/s (112% / 159%)36%551.9K (33%)23%
8 KB302.0K / 2.30 GB/s207.0K / 1.58 GB/s (196% / 160%)69%150.4K (50%)35%
64 KB42.7K / 2.60 GB/s30.0K / 1.83 GB/s (194% / 123%)70%27.2K (64%)36%
300 KB9.6K / 2.76 GB/s6.7K / 1.91 GB/s (166% / 148%)69%6.4K (66%)42%
  • Single-core pinned runs nearly match default multi-core throughput: 200 B differs by 2.4% (897.4K vs 919.2K), 1 KB by 7.6%, and >= 64 KB by under 10% (only 8 KB drops 27% when the receiver is limited to one core). Extra cores used under default settings mostly absorb background GC and I/O goroutines rather than scaling throughput linearly.
  • The Go-to-C++ gap narrows as payload grows: single-core Go reaches 25%–33% of C++ on small packets and 50%–66% on large packets. On small messages, fixed per-message costs (Protobuf encoding, two full copies, goroutine channel handoff, and GC) dominate; on large messages, those fixed costs amortize and extra buffer copies become the main difference. With AES-128-GCM, single-core Go reaches 39%–59% of C++.

GC Impact (GOGC=100 vs GOGC=800)​

libatbus-go holds a small live heap while allocating per-message temporary buffers proportional to payload size, so default GOGC=100 spends 11%–74% of process CPU in GC. Raising GOGC to 800 across 6 workloads × 5 payload sizes (30 Linux runs):

Comparison of default GOGC=100 versus GOGC=800 on Linux TCP across plaintext, AES-128-GCM, lz4, and zstd in libatbus-go

Solid lines: GOGC=800; dashed lines: default GOGC=100; matching colors share the same workload.

WorkloadPayloadQPS deltaGC CPU share recv / send (default → GOGC=800)Peak RSS recv / send (default → GOGC=800)
Plaintext200 B+8.0%19.0% / 15.0% → 2.8% / 2.0%15.8 / 16.0 MB → 43.2 / 42.4 MB
Plaintext64 KB+12.6%48.4% / 19.6% → 8.7% / 9.6%33.0 / 41.4 MB → 122.6 / 151.9 MB
Plaintext300 KB+17.5%50.9% / 49.1% → 10.4% / 12.2%43.8 / 44.7 MB → 130.7 / 146.3 MB
AES-128-GCM64 KB+25.9%52.2% / 73.2% → 10.2% / 11.7%21.2 / 36.3 MB → 180.3 / 129.4 MB
AES-128-GCM300 KB+23.4%53.0% / 60.9% → 11.1% / 11.8%29.0 / 37.1 MB → 162.0 / 121.9 MB
lz464 KB+11.1%38.9% / 41.9% → 6.8% / 6.0%16.5 / 20.9 MB → 53.1 / 64.8 MB
zstd1 KB+45.2%35.4% / 64.9% → 8.7% / 23.2%20.7 / 85.3 MB → 55.3 / 199.7 MB

Across all 30 runs, QPS rises by +10.4% on average (+8.2% median), while GC CPU drops from 11%–74% to 2%–23%. Large AEAD workloads gain 21%–26%. The tradeoff is 2.3x–8.5x higher peak RSS (40–225 MB per pair of nodes). Raise GOGC (or combine with GOMEMLIMIT) only on high-throughput central nodes, and keep the default on large numbers of small processes.

Same-Host IPC (Unix Domain Socket vs TCP)​

Go does not implement shared memory (shm://); its same-host alternative on Linux is unix:// (named pipes pipe:// on Windows were not benchmarked). Unencrypted, uncompressed baseline:

PayloadTCP (QPS / Throughput)unix:// (QPS / Throughput)unix:// vs TCPC++ shm:// vs TCP
200 B919.2K / 175.3 MB/s966.2K / 184.3 MB/s+5.1%0.73x
1 KB597.4K / 583.4 MB/s612.8K / 598.4 MB/s+2.6%0.91x
8 KB207.0K / 1.58 GB/s211.3K / 1.61 GB/s+2.1%1.26x
64 KB30.0K / 1.83 GB/s30.7K / 1.87 GB/s+2.2%1.18x
300 KB6.7K / 1.91 GB/s7.4K / 2.12 GB/s+11.2%1.07x

Gains stay within 2%–5% (the +11.2% at 300 KB sits within loopback run-to-run variance) because CPU is saturated by checksums, copies, Protobuf coding, and GC rather than TCP loopback syscalls. Encryption and compression continue to work normally over unix://.

Encryption and Compression Overhead​

Encryption Algorithms​

QPS and throughput of six encryption configurations over uncompressed Linux TCP in libatbus-go

Linux (default settings), no compression.

Cipher (uncompressed)200 B QPS1 KB QPS64 KB QPS / Throughput300 KB QPS / Throughputvs plaintext (200 B / 64 KB / 300 KB)
None919.2K597.4K30.0K / 1.83 GB/s6.7K / 1.91 GB/s—
AES-128-GCM664.0K419.8K19.6K / 1.20 GB/s4.3K / 1.23 GB/s-28% / -35% / -36%
AES-192-GCM656.4K422.1K18.2K / 1.11 GB/s4.2K / 1.21 GB/s-29% / -39% / -36%
AES-256-GCM647.5K407.4K19.6K / 1.20 GB/s4.1K / 1.19 GB/s-30% / -35% / -38%
ChaCha20-Poly1305609.4K384.9K15.6K / 972.0 MB/s3.4K / 989.4 MB/s-34% / -48% / -49%
ChaCha20 (raw)487.9K203.4K5.0K / 310.1 MB/s1.0K / 306.6 MB/s-47% / -83% / -84%
  • AES-GCM costs 25%–39% across all sizes—flatter than C++ (-55% on small packets, -10% to -15% on large packets) because cipher work overlaps with other goroutines on small packets while sender GC share climbs on large packets (73% at 64 KB vs 20% plaintext). Key lengths 128 / 192 / 256 mostly stay within 3% of each other.
  • ChaCha20-Poly1305 trails AES-GCM by 8%–21% and fits hosts without AES-NI. Raw ChaCha20 lacks authentication and is much slower; disable it in production.

Compression and Combined Encryption​

As in C++, payloads below 1,024 B (200 B / 256 B) skip compression, and the wire path always runs compress first, then encrypt (the Go data plane currently fixes the compression level to balanced, ignoring CompressionLevel).

QPS and throughput on Linux TCP in libatbus-go for no compression, snappy, lz4, zlib, and zstd alone and combined with AES-128-GCM

Linux (default settings). 200 B* is below the 1 KB compression threshold, so compressed lines coincide with uncompressed lines of the same cipher.

Compression (unencrypted)1 KB (QPS / Throughput)64 KB (QPS / Throughput)300 KB (QPS / Throughput)Measured ratio (1 KB / 64 KB / 300 KB)+ AES-128-GCM (64 KB)
None597.4K / 583.4 MB/s30.0K / 1.83 GB/s6.7K / 1.91 GB/s—19.6K / 1.20 GB/s
snappy374.9K / 366.2 MB/s12.3K / 770.8 MB/s2.3K / 661.1 MB/s50.0% / 36.4% / 36.5%11.7K / 729.9 MB/s
lz4313.1K / 305.8 MB/s9.1K / 570.8 MB/s1.4K / 397.0 MB/s57.2% / 40.4% / 39.3%8.9K / 555.8 MB/s
zlib7.2K / 7.0 MB/s1.9K / 116.7 MB/s452 / 132.5 MB/s32.0% / 21.7% / 21.9%1.8K / 113.9 MB/s
zstd4.5K / 4.4 MB/s1.6K / 98.6 MB/s565 / 165.6 MB/s40.2% / 25.9% / 25.4%1.3K / 83.1 MB/s
  • Use only snappy or lz4 for compression: both sustain 20%–63% of plaintext throughput, with snappy roughly 20% faster than lz4 (35% faster at 64 KB, 66% faster at 300 KB) and slightly better compression ratio. Adding AEAD encryption on top has minimal impact because sender compression dominates CPU.
  • zstd and zlib are two orders of magnitude slower and unsuitable for production: zstd drops to 4.5K msg/s at 1 KB (vs 183K in C++ on the same host). Profiling shows atframe-utils-go's compression adapter constructs a new encoder per message (EncodeAll consumes 41% of sender CPU, of which only 3.6% is actual encoding, while zero-initialization drives 65% GC overhead). In single-core pinned runs, 1 KB zstd runs 3.5x faster than under the 12-core default (15.8K vs 4.5K msg/s), indicating that multi-core GC amplifies short-lived large-object allocation costs. Per-message encoder construction also raises zstd sender private memory to 4x plaintext (see zstd Sender Memory Overhead).

Multi-Node Fan-In Scaling (2 to 1000 Nodes)​

Fan-in runs pin one receiver to dedicated CPUs 0–3 (GOMAXPROCS=4) handling 1 / 9 / 99 / 999 sender processes sharing CPUs 4–11 (GOMAXPROCS=1 per sender), across 20 combinations × 6 payload sizes (480 runs total, 467 valid). Isolating receiver cores from senders is required at high connection counts so hundreds of senders do not starve the receiver.

Aggregate QPS and throughput on unencrypted, uncompressed Linux TCP in libatbus-go for 2, 10, 100, and 1000 nodes with CPU pinning

Linux (CPU-pinned), aggregate measurements on the GOMAXPROCS=4 receiver.

Aggregate throughput peaks at 10 nodes (9 senders saturate the receiver, rising 46%–134% over 2 nodes). At 1000 nodes, plaintext sustains 1.14M msg/s (200 B) and 2.43 GB/s (300 KB), 17%–36% below the 10-node peak (receiver CPU reaches 371% at 8 KB and 388% at 32 KB, near the 4-core ceiling; small packets use 241%–298% and bottleneck in the serial node loop; the exact scheduling hotspot across 1000 nodes has not yet been profiled). Across all 467 valid runs, the maximum receiver sampling interval remained 1.0 s, and 1000-node registration finished within 0.2–0.8 s.

Aggregate QPS and throughput at 1000-node fan-in in libatbus-go across encryption and compression combinations, overlaid with 2-node snappy and lz4 references

200 B* and 256 B* fall below the 1 KB compression threshold and are not compressed; dotted lines show 2-node references, and all other lines are 1000-node measurements.

As in C++, parallel compression across senders shifts the bottleneck to receiver decompression: at 1000 nodes and 300 KB, lz4 climbs 4.58x over 2 nodes (6.6K / 1.90 GB/s) and snappy climbs 2.84x (6.7K / 1.93 GB/s).

Same-host Linux multi-node plaintext comparison between Go (4-core receiver) and C++ (1-core receiver), including receiver CPU-normalized per-core ratios:

Total nodes200 B: C++ / Go (Go %)1 KB: C++ / Go (%)8 KB: C++ / Go (%)300 KB: C++ / Go (%)Receiver 1-core normalized Go / C++
23.73M / 894.8K (24%)1.67M / 552.1K (33%)227.6K / 149.3K (66%)9.9K / 7.1K (71%)29%–56%
103.78M / 1.41M (37%)1.52M / 1.10M (72%)263.9K / 349.4K (132%)9.8K / 10.3K (105%)18%–45%
1003.69M / 1.21M (33%)1.47M / 988.4K (67%)259.3K / 304.6K (118%)8.9K / 9.6K (108%)12%–35%
10003.70M / 1.14M (31%)1.39M / 888.6K (64%)243.6K / 223.7K (92%)9.4K / 8.5K (90%)13%–26%
  • 13 excluded runs (all at 1000 nodes): 4 zstd 300 KB runs were stopped when per-message encoder allocations across 999 senders pushed available RAM below the 2 GB guard (root cause in zstd Sender Memory Overhead); 4 zstd 1 KB and 4 zlib 1 KB runs experienced mid-run receiver stalls (backlog drained only after senders exited); 1 AES-128-GCM + lz4 8 KB run had only 2 s of steady-state samples (below the 3 s threshold).

Memory Analysis and Tuning​

To explain why receiver RSS reached 1.33 GB at 1000 nodes / 300 KB (vs 334 MB for C++ on the same host) and why zstd 300 KB triggered the 2 GB available-memory guard at 1000 nodes, 30–90 s runs with per-second live-heap sampling and forced-GC heap profiles were collected on the same host. Neither issue is a memory leak.

Receiver Memory Breakdown and GOMEMLIMIT Tuning​

Live-heap stability across sustained traffic and repeated connect/disconnect cycles:

Diagnostic scenarioPost-GC live heap under loadHeap targetRSSKey findings
1000 nodes, 300 KB, 90 s620–755 MB (no upward trend from 10 s to 91 s)1.25–1.5 GB1.2–1.36 GB (peak 1.41 GB)760K messages processed, 9 GC cycles/s; drops to 82 MB after senders exit
1000 nodes, 200 B, 30 sFlat at 205 MB (≤ 2 MB variance)413–417 MB336 MB37.7M messages processed (< 1 B per message)
2 nodes, 300 KB, 30 s1–13 MB2–26 MB16–35 MBLow-connection reference
3 cycles of "300 senders connect → send → disconnect"230–300 MB per cycle—17–24 MB after each cycleLive heap returns to 1 MB after disconnect; goroutines drop from 1205 back to 5

Breakdown of the 667 MB post-GC live heap at 30 s (1000 nodes, 300 KB):

ComponentSizeShare
In-flight large frame buffers (~1,330 × 300 KB, ~1.3 per data connection)400 MB60%
Per-connection 64 KB read buffers (1,998 connections)122 MB18%
Connection structs (7 KB header buffer + 1,024-slot write queue channel)76 MB11%
Queued and being-decoded Protobuf copies in the node loop61 MB9%
  • Fixed overhead is ~97 KB per connection (~200 MB across 2,000 connections, matching the flat 205 MB live heap at 200 B). Large payloads add in-flight frame buffers on top, and default GOGC=100 lets the heap grow to 2x the live heap before triggering GC, keeping RSS near 1.3 GB.
  • Reducing RSS with GOMEMLIMIT: four runtime settings measured at 1000 nodes / 300 KB (30–90 s each):
Runtime settingQPSAvg / peak RSSGC cycles/sGC CPU share
Default GOGC=1009,2311,282 / 1,407 MB8.98.1%
GOMEMLIMIT=1GiB9,160893 / 925 MB17.714.1%
GOGC=508,935931 / 967 MB16.714.0%
GOMEMLIMIT=600MiB (below live heap)5,909566 / 621 MB69.542.1%

Setting GOMEMLIMIT above the live heap (such as 1GiB) cuts RSS by roughly 30% with QPS unchanged within noise (GOGC=50 performs similarly). Setting it below the live heap (600MiB) causes near-continuous GC and drops QPS by 36%. Code-level reductions remain possible in future work: pooling read buffers (up to ~120 MB saved), shrinking write-queue channels, and capping in-flight large frames or growing frame buffers incrementally as bytes arrive (up to ~300 MB saved, subject to throughput verification).

zstd Sender Memory Overhead​

Measurements across 300 senders (GOMAXPROCS=1 pinned each) transmitting 300 KB payloads:

Workload & setting (300 senders, 300 KB)Private RAM / senderPost-GC live heapHeap targetAlloc / msgGC cycles / msgAggregate QPS
Plaintext6.2 MB2.0 MB4.3 MB0.6 MB0.2710,041
zlib6.5 MB1.9 MB4.5 MB1.7 MB0.721,079
zstd, default GOGC=10023.9 MB10.1 MB20.3 MB9.7 MB1.01,543
zstd, GOGC=5020.6 MB10.0 MB15.3 MB9.7 MB1.01,660
zstd, GOMEMLIMIT=32MiB23.4 MB10.1 MB20.4 MB9.7 MB1.01,263
zstd, GOMEMLIMIT=14MiB10.9 MB9.0 MB9.6 MB9.7 MB3.51,391
  • Root cause: atframe-utils-go's compression adapter calls zstd.NewWriter on every message. At balanced, each writer allocates an 8 MB history window (82% of cumulative heap allocations) plus ~1.6 MB of encoder tables, totaling 9.7 MB per 300 KB message. Because each sender spends most of its time encoding, one encoder is always live (~10 MB live heap), and default GOGC=100 doubles headroom to ~24 MB private RAM per sender (4x plaintext; steady across 30 s and across 300 / 600 senders, confirming no leak). Across 999 senders that equals ~24 GB, driving available host RAM from 24.4 GB down to 2.5 GB within 3 seconds of start.
  • Mitigation and permanent fix: GOMEMLIMIT takes effect only below the heap target (32MiB has no effect; 14MiB cuts private RAM by 54% to 10.9 MB at ~10% QPS cost). The real fix is reusing encoders in atframe-utils-go: standalone microbenchmarks of a 300 KB message (GOMAXPROCS=1, balanced) show encoder reuse cuts per-message allocations from 9.2 MB to 0.30 MB (and time from 1.02 ms to 0.81 ms), while shrinking the window from 8 MB to 512 KB keeps the 300 KB compression ratio identical (25.4%). The zstd receiver is unaffected (0.85 MB/msg allocated, 7.6 MB private RAM in a pair).

Test Boundaries and Open Anomalies​

Account for these limits during capacity planning:

  • Communication library only: excludes atsf4g-go business scheduling (ActorExecutor), RPC envelopes, object routing, observability, and database I/O; validate production capacity by replaying realistic business RPC traffic.
  • No latency percentiles or multi-hop / full-duplex traffic: star-topology loopback unidirectional saturation tests exclude P50/P99 latency, physical NIC/WAN loss, full-duplex load, and multi-hop atproxy forwarding.
  • Runtime and payload dependence: GC share and scheduling depend on Go 1.27.4 and should be re-measured after Go upgrades; compression ratios and throughput use compressible JSON-like text, whereas high-entropy data yields lower ratios for the same CPU cost.

Four observed anomalies remain open for follow-up profiling:

  1. zstd/zlib are two orders of magnitude slower on 12 cores while running 3.5x faster on 1 core (per-message encoder creation is the trigger; multi-core GC amplification on short-lived large objects is suspected).
  2. Mid-run receiver stalls on 1000-node zstd / zlib 1 KB runs (data stalls between SendData return and the receiver socket, likely because 999 GOMAXPROCS=1 senders oversubscribing 8 cores starve writer goroutines under extreme harness saturation on modest test hardware).
  3. Native Windows large payloads reach only 21%–44% of Linux with receiver GC CPU at 89% (possibly tied to Windows large-block allocation/free overhead).
  4. At 1000 nodes, steady-state receiver throughput after kernel buffers fill and flow control engages is 20%–30% faster than during the initial buffer-filling phase (likely fuller reads and fewer wakeups).

Raw Data​

All six summary CSV files are downloadable below; complete build commands, full tables, and offline SVGs live in atframework/libatbus-go/docs/Benchmark.md and the GitHub benchmark report (memory diagnostics are summarized in this page and the upstream report without archived raw traces).

DatasetFilesDescription
Single-pair TCP baselineLinux CSV · Windows CSVFull metrics across 110 runs per platform
Same-host IPCLinux unix:// CSV5 unencrypted, uncompressed comparison runs
GC comparisonLinux GOGC=800 CSV30 runs across 6 workloads × 5 payload sizes
Single-core pinnedLinux GOMAXPROCS=1 CSV30 runs with 1 core pinned per side
Multi-node fan-inLinux 467-run CSVFull metrics across 2 / 10 / 100 / 1000 nodes

Summary​

libatbus-go completes the libatbus v2 protocol stack in Go and establishes same-host baselines against C++: single-pair Linux TCP reaches 919.2K msg/s (200 B) and 1.91 GB/s (300 KB), with single-core pinned runs at 25%–33% of C++ on small packets and 50%–66% on large packets; 1000-node fan-in with a 4-core pinned receiver reaches 1.14M msg/s and 2.43 GB/s. Memory diagnostics confirm that neither the 1.33 GB receiver RSS at 1000 nodes nor high zstd sender memory is a leak—they stem respectively from in-flight large frames plus ~97 KB/connection live heap under GOGC=100, and atframe-utils-go allocating a fresh 8 MB-window zstd writer per message.

For production deployments, enable AES-128/256-GCM, keep compression off on high-bandwidth intranets, choose snappy or lz4 on bandwidth-limited links (avoiding zstd/zlib until atframe-utils-go reuses encoders), isolate receiver CPU cores, and configure GOGC and GOMEMLIMIT (above the live heap) on throughput-critical nodes.