With Observe switched off, a Hew program running on two workers took about 136 milliseconds to complete 27,648 actor requests. With the profiler and tracing enabled, it took 163 milliseconds. We wanted to know how much of that extra time came with the basic counters, and what happened when the runtime had more workers available.
What the actors did
We gave each of 64 client tasks its own counter actor. Each request ran this handler.
actor Counter {
var count: i64;
receive fn increment() -> i64 {
count += 1;
count
}
}Each client asked its actor to increment the count, waited for the reply, added the returned value to a running sum and sent its next request. Clients could run concurrently. Within each client the previous reply had to arrive before the next request went out. For the two-worker profiler test each counter started at zero and received 432 requests, so the expected sum across all 64 clients was 5,985,792. The runner checked the sum on every execution.
There are a few ways an Observe user might run that program. With HEW_OBSERVE=hot, the runtime records measurements such as allocation counts and actor turns attributed to their handlers. Full observation adds tracing and starts a profiler endpoint with its sampler. In the benchmark, the runtime paid the cost of recording this data while the endpoint had no reader attached. The program checked that the requested mode had taken effect before starting the clients. Hew’s Observe counters
Timing the same executable twice
On October 30, we ran each pair on one Intel C4 VM. In 11 of the 21 full-observation pairs, the off run went first. The other ten ran in the opposite order. One pair came in at 135.8 ms off and 162.2 ms on, about 19.5% extra elapsed time. Across all 21 pairs the increases ranged from 15.5% to 26.5%.
The control used the same executable with Observe off both times. The control still produced individual timing differences from −4.1% to +6.3%. The geometric mean of their timing ratios put the difference at −0.08%. For each whisker in the chart, we resampled whole pairs 10,000 times and took the middle 95% of the estimates. The control interval ran from −1.24% to +1.13%.
With two workers, hot counters alone added 6.8% to elapsed time. With eight workers their estimated cost fell to 0.9%, with an interval from −0.8% to +2.7%. The full configuration added 12.3% on eight workers. The runner calibrated the number of requests separately for each comparison and kept that count fixed within each pair.
Where the CPU time went
On a busy machine we also care about the CPU time the process used across all its threads. Two threads running concurrently can accumulate two milliseconds of CPU time in one millisecond on the clock. We divided each pair’s difference in process time by the number of completed requests. Those figures include profiler startup and shutdown, spread across the batch.
The eight-worker batch incurred roughly half as much extra elapsed time per request as the two-worker run. It also consumed over twice as much extra CPU time per request. Both runs needed more resident memory with full observation, about 7 MiB at peak. A service running alongside other CPU-intensive processes has to budget for those processor cycles even when its own completion time changes little.
Echoing a request across two VMs
The network tests timed each round trip on the client’s monotonic clock. In one version a TCP server echoed 64 bytes. In the other, a Hew client sent the payload to a remote actor over an authenticated connection and checked the reply. The latter included actor dispatch and the work of encoding the message. We enabled the same observation mode at both ends. Each trial began with 32 warmup requests, followed by 1,024 measured round trips with one request outstanding.
For each trial we sorted its 1,024 timings and took its percentiles. Each mark in the chart is the median of that percentile across 21 trials. The TCP median changed by about 0.3 µs, within the variation of the control runs. For the actor echo, the median moved by 7.4 µs and the 99th percentile by 7.5 µs. Because we enabled counters on both machines, the 7.4 µs includes work on both ends of the connection. A repeat with just the sender instrumented would isolate its contribution.
We also tried a busier client. Eight tasks each sent 128 requests of 4 KiB to the same remote actor, with up to eight requests outstanding. Within a zone, the median throughput fell from about 27,700 requests per second to 24,900 when we enabled hot counters. At the 99th percentile a reply took 466 µs with counters off and 558 µs with them on. That test changed both concurrency and payload size. Its tail latencies describe a different service load from the 64-byte echo.
Placement mattered too. In the TCP controls, the median same-zone round trip was about 45 µs. The median across two zones in the same region was about 510 µs. We kept the endpoints in place for each off/on comparison.
The October suite also timed equivalent vector operations in Hew and Rust. Scanning 4,096 elements took 3.76 times as long in Hew. A vector scan gave us a small loop we could inspect all the way down to the machine instructions. In November, we used it to investigate a timing difference between two Hew builds.