Proxy benchmarking · part 2 of 2
Envoy benchmarking with an extended Nighthawk: an agent-driven screen, checked against restarts
By Otto van der Schaaf, We-Amp ·
Every Envoy CPU figure we publish comes out of a slow cycle: a written plan, a review of that plan, one long session on a dedicated test machine, a result write-up and a second review. Every idea paid for the whole cycle, and many ideas ended below the line we report at. We wanted to know, before paying for that cycle, whether an idea moved anything at all.
So we extended Nighthawk, the load generator we measure with, and put an agent in front of it. The agent drives Nighthawk and Envoy on the test machine through one SSH session. It flips one setting at a time inside 12 short-lived Envoy processes and gets back cycles per request for one candidate in about half an hour. Before using it, we checked it against a patch of ours with a runtime guard, beside a slow restart-paired run of the same comparison in the same session. The two agreed: a ratio of 0.988. The pattern, a fast screen that may steer but never decide, checked against the slow method on the same comparison, applies to any benchmark gate that takes too long per idea.
The loop’s numbers never become a published row or a price in the price list. This post shows the calibration screens’ numbers, labelled, as evidence about the loop. The loop only chooses what goes into the next pre-registered session, and that session decides. Part 1 of Proxy benchmarking explains the labels and the method this post builds on.
(The author of this post is an emeritus maintainer of Nighthawk.)
Key points
- The slow cycle stays; the screen is there to keep ideas that move nothing out of it. A screen of one candidate took about 31 minutes on the test machine; the restart-paired run of the same comparison, 48 rounds, took 101. So far it has screened only its two calibration controls.
- A screen runs in 12 short Envoy processes. Each one flips a runtime guard between 10-second windows, with an A/A pair of its own; the interval is taken across processes, not across pairs inside one.
- Inside one process the pairs are tight, about 25 times tighter than between processes. Our first calibration showed that this precision belongs to one process, so we changed the design.
- The screen tracked a restart-paired run of the same comparison. On a published patch of ours, the screen read −1.86 log points and a restart-paired run in the same session read −1.88: ratio 0.988 [0.868, 1.144], inside the band we set before the run. A second control, a patch that saves work per connection, read 0.970 [0.937, 1.005], in a reading that follows a recovery after the data.
- Both are smaller than the published row for that patch, −2.88%. That gap is between sessions, and it is open.
- The loop steers, a session decides. In-process numbers are labelled Exploratory, never scaled, and never become prices.
Contents
- Why was each idea so slow to test?
- What did the load generator cost us?
- What did we change in Nighthawk?
- How does the loop work?
- What did the first calibration show?
- Did the screen track a restart-paired run?
- What did the screen teach us about itself?
- Why does the loop never decide?
- How much faster is it?
- What can the loop not do?
- Where are the code and the data?
Why was each idea so slow to test?
Because every step that makes a number trustworthy happened once per idea, in sequence:
- A written plan, fixed before any data. It names the rows, the arms, the number of rounds, the kill lines and the A/A floor. Anything added after seeing data is labelled Exploratory.
- An agent review of the plan, through multiple independent lenses using top-tier models, revised until every review signs off, and then approved by the author.
- A build, when the idea is a code change: a separate source tree, an optimized binary copied out and its hash recorded, and a code review.
- One session on the test machine: a check that the machine is idle and clean, a smoke-and-gates chain, the scored chain, and a clean proof at the end.
- A result write-up with every row, its interval and its basis.
- An agent review of the result, the same way, again to sign-off.
- A port of the reviewed rows into the posts and the price list.
None of these steps is waste. The first two stop us from finding what we hoped to find. A wrong binary once voided three early verdicts, which is why every binary is now hashed (what did not hold up). The result reviews asked for changes in most sessions. But the cycle has a fixed cost, paid before we know whether the idea moves anything.
Two examples. A follow-up session planned 491 measurement legs at about 7.9 hours, and its plan was signed off at its third revision; the session ran 7 h 06 min. A patch that removed the copy of a chunked HTTP/1 body went through the whole cycle to read −1.40% [−2.31, −0.48] at 1 MiB, below the 3% saving we require before we propose a patch, and we do not propose it. That is a correct result, and it took the whole cycle to reach it.
What did the load generator cost us?
Several of our footnotes traced back to how we drove the client, not to Envoy. Each one cost a leg, a re-plan or a “Not resolved” clause:
- The client ran for a fixed time; our window did not. In one session, slower counter reads on a traced leg stretched the measurement window to 24.21 s against 20.18 s to 20.21 s in every other leg. Its end ran past the end of the client’s run, so the window counted seconds with no load, and our rate gate voided the leg at −3.5%.
- Whole-run numbers include the ramp. Nighthawk reports counts over the whole run. On one leg, hits per request computed from the run-wide rate read 1.021, a fail; from the steady part of the run it read 1.0006.
- The rate is per client worker.
--rpssets a rate per worker, so a total of 1,800 requests per second over 16 workers cannot be set; we ran 1,760. - Two client processes per leg. The warm-up ran as its own process, so every leg opened its connections twice: 32 connection lifetimes for 16 connections.
- A self-check that never failed. Our client-headroom check read 0.72 to 0.78 in every shape, whatever the protocol and rate, so it could not see a saturated client.
None of this changes a published row: each was caught by a gate or written into the row’s conditions. But each made a cycle longer, and a loop that answers quickly needs a client whose lifetime, counts and rates line up with the window being measured.
What did we change in Nighthawk?
Our changes are on our public Nighthawk fork, on top of upstream commit d5d185d. None has been proposed to the Nighthawk project.
On the fork’s main branch:
- Phases. A run can be a sequence of phases, each with its own duration, rate and worker count (
7298669). Each phase gets its own result with fresh latency statistics and per-phase metadata: requests started and completed, drain times and connection-pool health (15254e4). A phase’s total rate is divided across its active workers, with the remainder going one request per second to the lowest worker indexes. A warm phase and a measure phase in one process replace the separate warm-up process. - Live snapshots. Over the gRPC service’s execution stream, a run sends snapshots while it runs: a monotonic timestamp, cumulative counters and p50, p90 and p99 per statistic (
e578d5b). The percentiles are the maximum over workers, not a merged histogram. - Steering. A running benchmark accepts a new rate or ramp, acknowledges when it applied it, and stamps every later snapshot with a knob epoch, so a window can be tied to the setting that produced it (
e5dd71e,73c7b6c). A run can also be cancelled remotely (008d00f). - Envoy stats sinks in the client.
--stats-sinksnow finds Envoy’s own sink extensions such asenvoy.stat_sinks.statsd(b3edba9). - An MCP server,
nighthawk_mcp, so an agent can drive the service (7c7fa93). It speaks the Model Context Protocol over stdio. Its tools start, steer and cancel a run and report its status; its resources carry the status, a per-second series of client and Envoy counters, the phase timeline and the session record. Its safety floor refuses targets outside loopback unless widened, refuses rates above a ceiling, and ends a run whose session went away (381cc07,df55226). - A terminal UI for watching and steering a run by hand.
On a branch, feat/rps-total-phases: phases from the command line (--phases as JSON), protocol (h1, h2, h3) and request body size in start_run, and a test that a warm phase’s connections serve the measure phase with no new connection after the boundary. On the branch’s code, 11 of its 12 unit-test targets passed; the twelfth, //test:process_test, times out the same way on the commit the branch starts from. The carry-over test passed for h1, h2 and h3, over IPv4 and IPv6. The branch is not merged into the fork’s main.
The pinned clients. The published runs used a nighthawk_client built from the fork at 5fc3897, with only client options that upstream Nighthawk also has. Each new client is adopted only after a pre-registered comparison against the one before it. The current one, tag epl-client-2026-11/v2 (commit 63d819f, on its tag; not merged into the fork’s main), was adopted for one traffic shape (HTTP/1.1, 4 KB proxied responses, 5,200 requests per second): its level and its access-log price equal the previous client’s within 1.0 log point, over 42 rounds with no pool or pending overflow on any client worker.
In our harness, which drives the client in every scored session:
- The client’s lifetime follows the window. The client runs with upstream’s
--no-duration, and the harness sends one SIGTERM to the process it started after the window’s last read. The first SIGTERM cancels the run gracefully and the client still prints its full output. - A fail-closed check that the client was sending through the whole window. The leg above that lost its last seconds of load would now fail by name instead of as a −3.5% rate miss.
- Per-request figures from in-window counts only, never from the client’s run-wide rate.
- A client self-check that can fail: a zero-load leg per session for the client’s idle floor,
perf staton the client process, and a gate on client overflow counters, with a deliberate overflow run per session to prove the gate fires.
How does the loop work?
One SSH login carries the whole session. The agent’s MCP configuration starts the daemon on the test machine as its stdio command, through SSH. Every request and reply travels inside that one session, so nothing polls the machine and no new login appears in the middle of a measurement. We tested four ways the session can end: the client going silent, the client process being killed, its input closing, and the shared SSH connection closing. Each time the daemon tore down everything it had started. The next session starts from a clean proof, never from a half state.
The daemon on the test machine is the MCP server. It starts nighthawk_service and nighthawk_mcp as children and forwards the Nighthawk tools. It adds three groups of its own:
- Envoy control: start an instance from a pre-staged binary checked by its hash, flip a runtime guard through Envoy’s admin interface, push a file-based xDS update, restart.
- Telemetry: price a step, which returns cycles per request per arm over a named interval.
- Explore: one warm Envoy with runtime flips and a per-second timeline, for checking that a flip reaches the request path. It gives no effect interval and writes no candidate record.
- Guards: a check that the machine is idle and free of foreign activity, a ledger of the processes it started (it stops only those), a time limit, and the clean proof at the end.
Its own cost is counted. The daemon, nighthawk_mcp and the SSH session run on housekeeping CPUs, never on one of Envoy’s CPUs or their hyperthread siblings. Each step reports their CPU, and fails if anything of ours ran on Envoy’s CPUs.
A screen is 12 short Envoy processes. Each instance starts from the hashed binary, warms up, then runs four pairs of 10-second windows with the guard flipped between them in balanced order, plus one A/A pair that writes the value already set (the per-connection control’s screen used four). Each instance gives one effect. The screen’s interval is taken across the 12 instances; six is the floor below which a screen does not count. For a guard that is read when a connection is built rather than per request, the step cycles the client’s connections after each flip.
Telemetry lands on one clock. Each step gets one timeline in 1-second bins on the test machine’s monotonic clock: perf stat on the Envoy process alone (user and kernel cycles and instructions), Envoy’s own count of 2xx responses from one filtered admin read per second as the denominator, and the client’s per-second counts from Nighthawk’s live snapshots as a cross-check. The admin read is served by Envoy’s main thread and counts in Envoy’s cycles, so its filter and cadence are the same in every arm. Kernel cycles are those charged to Envoy’s threads; on loopback some network-stack work lands on the sending side, the client’s included. The split is the same in every arm, which is what a paired comparison needs. We do not use a statsd sink for this: in our price list the sink itself has a measurable CPU price.
Each step returns one compact JSON object: a summary with the effect per instance, the interval across instances, the A/A result, the gates passed or failed and our own CPU, stamped “in-process effect, Exploratory”. Raw files stay on the machine until the session’s collection step.
The reply to screen_result for the per-request control’s screen, as the agent read it, trimmed: the per-instance list, the field labels and the daemon’s own CPU accounting are cut.
{
"screen": "scr01",
"status": "complete",
"basis": "in-process effect, Exploratory",
"spec": {
"key": "envoy.reloadable_features.otel_tracer_deferred_span",
"off": false,
"on": true,
"rate": 5200,
"instances": 12,
"pairs": 4,
"aa_pairs": 1,
"window_s": 10
},
"instances_run": 12,
"instances_valid": 12,
"across": {
"n": 12,
"df": 11,
"mean_lp": -1.8572,
"t95_lp": [-1.9219, -1.7924],
"sd_between_lp": 0.1019,
"mde_lp": 0.0905
},
"within": {
"df": 36,
"pooled_sd_lp": 0.0799
},
"instance_sd_lp": 0.0938,
"marker": {
"mean": 8803.81,
"t95": [8793.81, 8813.8],
"reached": true,
"sign": "on removes instructions"
},
"aa": {
"mean_lp": 0.0658,
"t95_lp": [0.0125, 0.1191],
"contains_0": false,
"ok": false
},
"validity": {
"reasons": [],
"valid": true
},
"reading": "Not resolved (in-process effect, Exploratory): the in-screen A/A check failed (pairing, drift or the instruments).",
"not_published": "not a published row: an in-process screen; publication needs a pre-registered between-process confirmation session",
"candidate": false
}
Its reading says Not resolved because the daemon applies its own A/A rule, not the plan’s; the section on what the screen taught us has both readings.
What did the first calibration show?
Our first design put the whole screen in one long-lived Envoy process. In three A/A blocks of 8 pairs of 20-second windows, each block in its own process, the pooled per-pair spread was 0.043 log points, and the pooled A/A difference was −0.005 [−0.024, +0.013]: no bias from the pairing or the analysis. Between separate processes in the same session, the per-round spread was 1.105 log points, about 25 times larger. (A log point is 100 times the natural log of a ratio; at these sizes it reads as a percentage.)
As a known effect we used a published patch of ours with a runtime guard, a deferred OpenTelemetry span at 0% sampling: −2.88% [−3.70, −2.06] between separate processes. Flipped inside one warm process, in two blocks of 8 pairs, the guard read −1.84 log points. The flip did reach the request path: it removed about 8,800 instructions per request, within 1.2% of what the two builds differ by. But the effect differed between the two processes by 0.16 log points, about five times the uncertainty inside either block. So the tight interval was an interval for one process. Taken across the two processes (n = 2) it was [−2.84, −0.83] (Exploratory): wide, and with two processes no better than a rough bound.
Our gate for building the rest of the loop had asked the in-process interval to overlap the published one. It did not, so the gate read no-go, and we left it standing as recorded. Looking back, that gate had two faults. Requiring two intervals to overlap penalizes the more precise measurement: the tighter the in-process interval, the easier it fails. And it compared against a number from another session.
We changed the design instead of the gate’s record:
- the screen moved from one long process to several short ones, with the interval taken across them;
- the new gate compares the screen with a restart-paired run of the same comparison in the same session, as a ratio, with a band fixed before the run;
- it uses two controls: one patch whose saving is per request and one whose saving is per connection.
Did the screen track a restart-paired run?
On the per-request control, yes. On the per-connection control, only in a reading after a post-data recovery (below); as run, it was Not resolved. The gate: the 90% Fieller interval of the in-process effect divided by the restart-paired effect had to lie wholly inside 0.5 to 1.5, both effects had to be resolved with the same sign, and the instruction-count marker had to move in both. The band is wide: a screen that read half the true effect would still pass it. The observed ratios were 0.988 and 0.970. The band was set after the first calibration’s no-go, with that session’s ratio (about 0.63) known; the second session’s data are new. Before the run, the plan put the chance of passing at about 2 to 1 (the plan expected the screen to read low, near 0.63).
| Per-request control: the deferred OpenTelemetry span | Result | Basis |
|---|---|---|
| Screen, 12 short instances, 10 s windows | −1.857 log points [−1.922, −1.792] | in-process effect, Exploratory |
| Restart-paired, 48 rounds, same session | −1.88 log points; −1.86% [−2.57, −1.15] | Measured (pre-registered) |
| Ratio, screen to restart | 0.988 [0.868, 1.144] (90% Fieller interval) | the pre-registered gate statistic |
| Same-build check of the restart-paired run | +0.12% [−0.58, +0.83] | Measured (pre-registered) |
| The published row, an earlier session | −2.88% [−3.70, −2.06] | Measured |
All 12 instances were valid, and the interval of the A/A differences across instances lay inside the pre-registered ±0.25 log points. The intervals for the two measured rows are 95% unless marked, and the percent figures are widened by our between-session term.
The per-connection control is a second patch of ours, which removes work once per connection rather than per request. Its own figures are not published yet. Its ratio, screen to restart, was 0.970 [0.937, 1.005]. As run, its restart-paired arm had no valid data, because one validity reference had not been frozen before the run, so the reading of record is Not resolved. The 0.970 comes from freezing that reference from the pre-run smoke test after the data, under conditions written before any restart figure was computed. A further ruling on the scope of one condition was made after that condition’s output, by the author and reviewers who already knew the screen’s result. Under the strict reading of that condition, the per-connection control is still owed.
What the result allows. The loop may screen runtime guards read per request, and guards read per connection with connection cycling, on traffic shapes whose first screen passes its own A/A check, with the screen design validated here (12 instances, four pairs, 10-second windows, six the floor) and the client the calibration used, the version before the current one. The per-connection half rests on the recovered reading above. Under the strict reading, per-connection guards wait for a fresh control in a later session. No calibration factor is fitted: an in-process figure is never scaled into a between-process one, and a ratio near 1 on two controls does not make every in-process number a price.
The gap to the published row is open. The restart-paired run read −1.86%; the published row, from an earlier session with the same patch, read −2.88%. On the two quoted intervals that difference is not resolved at 95%, but the new point lies outside the published interval. The published row compares the patched build with the official one. In that same earlier session, the patched build with the guard off read the same as official, and flipping the guard between separate processes read −2.78%. So the gap is not the difference between a build comparison and a guard flip. Two things on the client side differed from the published session: the client build (a newer pinned client, adopted against the old one within 1.0 log point on level and on the access-log price) and one setting, the pending-request limit. Checks on unmodified Envoy found each gives the same level within our equivalence bound, and no client worker reached the pending limit, so the client is an unlikely cause. That is an inference, not a test of either change with the tracer, and we have not identified the cause. What the calibration shows is narrower: inside one session, the screen and the restart-paired run agree. The first calibration’s screen read −1.84, close to this one’s −1.86; what changed is that this time the reference was measured in the same session.
What did the screen teach us about itself?
Three things, each now in the plan for the next screens:
- The first window is warm-up. The A/A difference was +0.128 log points when the A/A pair opened an instance and +0.003 when it closed one. It still passed, and its bias on the screen’s effect was about 0.016 log points. The next screens will discard one warm window per instance.
- A 31-minute screen drifts a little. Instances 7 to 12 read the effect 0.13 log points smaller than instances 1 to 6, while the clock frequency stayed flat and the restart-paired run showed no drift. Against this control’s size that is about 7%, and each half of the screen alone still fell well inside the band. Against a screening line of 0.3 to 0.5 log points it is not small. The next screens will interleave the candidate with a control, or alternate the instance order; our session gate prints the trend across instances.
- Two A/A rules can disagree. The daemon’s built-in A/A check (does the interval contain zero?) read Not resolved on the per-request screen. The pre-registered rule (is the interval wholly inside ±0.25 log points?) passed, and the gate applied the pre-registered rule. We report both readings. As run, the daemon still applies its built-in rule, and its reply says so in its reading.
Why does the loop never decide?
Because an agent that picks its next step from the last result will find something, whether or not it is there. Each step looks at the data and then chooses what to measure next. That freedom is what makes the loop fast, and it is also why its numbers cannot carry a verdict.
- Tier 1, the loop, steers. Every number it produces is stamped “in-process effect, Exploratory”, in the data and in the reply the agent reads. A loop number never becomes a published row or a price. Every instance carries its own A/A pair, so a step whose A/A is off says so.
- Tier 2, a pre-registered paired session, decides. When the loop finds something worth confirming, the daemon writes a candidate record: the shape, the arms, the effect seen and the number of instances, with the calibration’s result as context, never as a factor. The next plan imports it as a row, with its kill line fixed before data, balanced order, an A/A floor and gates that fail closed. Only that session gives Measured, Not resolved or No verdict, and the loop’s estimate is not used in its analysis.
This is the same rule we use for AI agents elsewhere in the company: an agent can raise a candidate and stop a change, and a check or a person clears it. Our release train and our guardrails apply it to code and releases.
The daemon’s rules for a screen leave the agent no room to stop a screen when the answer looks good. The number of instances, 6 to 40, is fixed when a screen starts, and a screen is never extended or pooled, so the agent cannot stop early on a good reading. No effect figure can be read until the screen is complete, and an aborted screen never shows one. Every screen goes into a register, a second screen of the same key in a session is refused unless it is declared as a repeat, and a candidate record carries the number of screens behind it. The session itself ends after 4 hours by default (12 at most), or after 15 minutes without a message from the agent while no step is running, and the daemon then tears down everything it started.
How much faster is it?
A screen of one candidate took about 31 minutes of machine time. The restart-paired run of the same comparison, 48 rounds, took 101 minutes, and it sits inside a session that also needs a plan, a review and a write-up. The screen does not replace that session for any idea we publish. The saving is on the ideas it drops, which never reach a plan. Per idea it drops, that is about 31 minutes of machine time instead of a plan, two reviews and a session of several hours.
Twelve restart-paired rounds would take about 25 minutes, but resolve only about ±0.6 log points before the between-session term. The screen’s interval across its 12 instances was ±0.065: about ten times tighter for about the same machine time. That precision is what lets it drop ideas that would end below our reporting line. It is an in-process precision, which is why a kept candidate still gets a restart-paired run.
A kept candidate still pays for a plan, a review, its confirming session and a write-up. A dropped one pays for the screen only.
At publication the loop has screened only its two calibration controls. No new candidate has yet been through a screen and a confirming session.
What can the loop not do?
- Resolve small effects. The smallest effect we have checked the screen on is about 1.9%. Anything finer rests on arithmetic. Under about 1%, nothing from one session.
- Decide anything. Its numbers are steering only.
- Screen a change without a runtime guard. A code change needs a pre-staged binary and a restart, which is slower and brings a binary-layout effect of its own. Rebuilds stay outside the loop: binaries are built elsewhere, reviewed and hashed first.
- Measure latency tails at load. Nighthawk’s latency is measured from when a request is sent, not from when it was due, and requests dropped by overflow leave no sample. Live-snapshot percentiles are also the maximum over workers, not merged. The loop explores CPU per request.
- Speak for other machines. It runs on one dedicated 2016 server over loopback, Envoy v1.40.2 with 4 workers on CPUs it does not share, one traffic shape for the per-request control, like the rest of our Envoy work. On shared or virtualized hardware the spreads will be larger, and the screen would need its own calibration there.
- Run for free. The daemon and the admin reads add load. They are counted, and identical in every arm.
Where are the code and the data?
- Our Nighthawk fork: phases, live snapshots, steering, the MCP server, and the branch
feat/rps-total-phases. - The harness, with the client changes above: github.com/We-Amp/envoy-price-list; its README covers both the harness and the loop.
- The session daemon:
loop/in the harness repository, with its operator’s guide. Its tests run on any machine against stand-ins for Envoy’s admin interface, the client andperf. - The calibration data: a data release with both calibration sessions’ screens, restart-paired runs and gate outputs follows on the harness’s releases page. The per-connection control’s runs follow when its own figures are published.
Corrections and your own results go to the harness’s issue tracker.
Credit
Nighthawk and Envoy are the work of their contributors. The phase, snapshot, steering and MCP code described here is ours, on our fork, and any error in it is ours. --no-duration and the graceful SIGTERM handling we rely on are upstream Nighthawk’s. The Model Context Protocol is an open protocol.