grpcproc
Documentation

Performance

grpcproc measured against GoAkt, Hollywood, Proto.Actor and Ergo on local and remote sends and requests.

benchmarks is a module of its own, so grpcproc does not depend on what it is compared with, and it measures the working tree. The frameworks are GoAkt v4.5.6, Hollywood v1.0.5, Proto.Actor on its development branch, which has no Go-style release tags, and Ergo 3.3.0.

Method

  • The same message, wrapperspb.Int64Value, because Hollywood and Proto.Actor need protobuf to go remote. Ergo's network registers struct values and not pointers, so it sends a struct holding the same int64.
  • Send is end-to-end throughput: the timer stops when the receiver has counted every message, not when the sender has queued them.
  • Request is one caller waiting for each reply; parallel is RunParallel callers against one echo.
  • Remote is two engines, systems or nodes over real TCP on loopback, the connection warmed up before timing. grpcproc's own benchmarks in the root module use in-memory connections, which would favour it here. GoAkt's remote actors are found with the public PID.RemoteLookup and reached through its remoting client, as an application would; Ergo's nodes find each other through its embedded registrar, on a port of their own.

Each framework is its own package: Hollywood and Proto.Actor both register a protobuf file named actor.proto, which cannot share a binary, and separate binaries also keep one framework's globals, Proto.Actor replaces gRPC's logger, out of another's numbers.

Results

Apple M3 Max, -count=6, medians by benchstat. The fastest in each row is bold.

grpcprocGoAktHollywoodProto.ActorErgo
Local send96 ns, 0 allocs95 ns (±15%), 0 allocs59 ns, 0 allocs200 ns, 0 allocs198 ns (±23%), 3 allocs
Local request761 ns, 2 allocs568 ns, 2 allocs2362 ns, 12 allocs2451 ns, 10 allocs3200 ns, 5 allocs
Remote send382 ns, 6 allocs520 ns (±10%), 7 allocs197 ns, 7 allocs340 ns, 9 allocs551 ns (±18%), 10 allocs
Remote request44.8 µs, 52 allocs35.9 µs, 42 allocs37.6 µs, 66 allocs60.7 µs, 103 allocs49.6 µs, 21 allocs
Remote request, parallel7.5 µs, 27 allocs10.1 µs, 40 allocs5.0 µs, 54 allocs7.0 µs, 54 allocs6.5 µs, 19 allocs
Geometric mean1.56 µs1.59 µs1.39 µs2.35 µs2.58 µs

Proto.Actor's local send varies between runs, 94 ns in one run of six and 189 to 200 ns in four others, and GoAkt's and Ergo's sends vary within one, as marked; the others hold within a few percent. A mailbox that keeps up, and a local send, allocate nothing.

Reading the results

  • The transport decides sequential remote latency. GoAkt, with its own TCP protocol, and Hollywood, with dRPC, answer a remote request in 36 to 38 µs; the two that speak gRPC take longer, grpcproc 45 µs and Proto.Actor 61 µs. gRPC-go's writer adds a goroutine hand-off in each direction. On a real network the round trip dwarfs the difference; for grpcproc it is the cost of living on the application's gRPC server.
  • Against the other gRPC library, grpcproc answers a remote request 26% sooner than Proto.Actor and trails it by about 40 ns on remote send, where Proto.Actor's writer batches up to a thousand envelopes.
  • Locally, a grpcproc call waits on one channel of its own where Hollywood and Proto.Actor create a temporary process per request, which puts it three times ahead of them. GoAkt is quicker still, with as many allocations per call.
  • Ergo starts a goroutine per hop. A sleeping process runs on a new goroutine each time a message wakes it, and so does each connection's read queue and each write flush. A request finds its echo asleep every time, so a local one takes 3.2 µs and a remote one 50 µs, over Ergo's own TCP protocol; a stream of sends keeps the sink awake. Its remote calls allocate least of all, and it is second only to Hollywood on parallel requests.
  • Hollywood's sends are fastest everywhere, with a lighter transport and vtprotobuf-generated envelopes. grpcproc also pays, on every message, for what its Inspector reports: per-process counters, mailbox ages, and a type check on delivery.

Ergo and its keepalive

Ergo runs with its software keepalive off, the one default changed. With it on, parallel remote requests timed out in 8 runs of 16: each connection's flusher arms one time.AfterFunc timer from its writers (500 ns) and from its own callback (15 s, the keepalive), and on Go 1.26.0 and 1.27.1 a Reset to 500 ns is now and then lost when more than one P runs. The batch of calls then sits unsent until another timer runs, at worst the keepalive, past Ergo's 5 s call timeout. The standard library alone reproduces it. The keepalive sends nothing while messages flow, so the numbers are still Ergo's.

Running the benchmarks

cd benchmarks
go test -run '^$' -bench . -count=6 ./... | sed 's|pkg: .*/benchmarks/|pkg: |' > new.txt
benchstat -table goos,goarch,cpu -col pkg -row .name new.txt

CI only checks that the benchmarks still build and run briefly. The numbers above are from one machine, and a change to grpcproc's hot path is measured again by hand.