Envoy performance · part 3 of 6
Envoy code layout: PGO vs AutoFDO, BOLT and lld ordering
By Otto van der Schaaf, We-Amp ·
On a proxied 4 KB response on a 2016 Intel Xeon (Broadwell) server, 74% of the official Envoy binary’s user-space pipeline slots were frontend bound: the front end did not deliver instructions to execute, mostly because of instruction-fetch latency. Our PGO and ThinLTO post guessed at that without counters. This post measures it and tests three cheaper tools that move code within the binary.
Key findings
On one bare-metal server at a fixed clock, against the official v1.40.2 release build:
- PGO + ThinLTO stays the largest gain: 36% to 40% fewer cycles per request (the PGO post measured 33% and 39% on this server against a same-commit build, on a newer commit).
- An lld call-graph ordering file, a relink of the release objects: 7% to 10% fewer cycles, a fifth to a quarter of the PGO gain. It sets function order only.
- AutoFDO with ThinLTO (sampled-profile PGO): 15% to 17% fewer cycles, 42% of the PGO gain, under the 50% bar we set. This is a result about our configuration (no
-fdebug-info-for-profiling, a profile thinner thanllvm-profgenasked for), not about AutoFDO for Envoy. - AutoFDO plus the ordering file: another 4.7% on the proxied shape, about half of the PGO gain when chained through two sessions (modelled; the interval includes 50%).
- BOLT on top of PGO + ThinLTO, proxied shape: about 5% fewer total cycles (roughly 2.5% to 7.5%, pooled from two sessions, exploratory); 11% to 12.5% fewer user-space cycles.
- A PGO profile from Envoy’s own tests, with no traffic trainer: about 16% to 17% fewer cycles per request (17% on the proxied shape, 16% on the header-heavy direct response). It kept 44% to 45% of the traffic-trained profile’s gain, under the 50% bar we set beforehand, and the traffic-trained profile was trained on the shapes it is scored on (details).
- On Arm, measured separately on a Neoverse V2 cloud VM and a bare-metal Neoverse N3 server: PGO + ThinLTO used 28% to 38% fewer cycles; on bare metal the ordering file used 4% to 7% fewer and AutoFDO about 16% fewer, and BOLT, profiled with Arm’s sampling profiler (SPE), gave no gain of 1.5% or more (details).
What to do: if a PGO training step is within reach, it gave the most. Without one, the ordering file is the cheapest step measured: a relink of 2 minutes here, with the build’s object tree still cached.
Every sampled profile came from the traffic we measured, so expect less on other traffic. The proxy ran on loopback at low load, where requests likely start with a partly cold instruction cache, so layout gains may be smaller on a busy proxy. The x86 figures are from one 2016 Intel server, 4 workers; no throughput figures. This post is part of Envoy performance, measured, a series with one method.
Builds, shapes and labels
All builds are ours, from Envoy v1.40.2 with the release options. Our plain build was byte-identical to the official release binary (SHA-256 1d64506e25c1844f146162ddb2ece7010fa4e784faddb40a079021491f1f03cc), so “release build” means the official binary. Effects are changes in user plus kernel cycles per response, with 95% intervals. Shapes: s, a proxied 4 KB response at 5,200 requests/s; fh, a header-heavy direct response at 8,000/s; fl, the same headers on a proxied 4 KB response at 5,200/s. “No verdict” marks a shape where the run’s same-build repeat missed its gate, so under our rule it supports no conclusion; “exploratory” marks a figure chosen after seeing the data, and “modelled” arithmetic on measured figures. The pooled BOLT figures use normal-approximation intervals and the shares a t interval on the delta-method error; the rest, the wider of the two intervals under the method.
Where Envoy’s release binary spends its cycles
Before any rebuild we counted the official binary’s user-space time with Intel’s top-down method, on the same server and shapes. On s, fh and fl, 73.8%, 61.8% and 59.0% of pipeline slots were frontend bound (fetch latency 66.0%, 54.5% and 52.0%); instruction-cache stalls took 25.1%, 22.5% and 20.0% of user cycles, and iTLB walks 3.1%, 2.8% and 2.5%.
That is 4,000 to 8,000 instruction-cache misses per request, roughly 250 to 500 KB of code fetched, from L2 or L3: under one last-level cache miss per request reaches memory. Requests likely arrive after idle periods in which kernel work evicts the proxy’s lines; that was not measured. iTLB walks take 1.8% to 2.0% of all cycles, an upper bound, so 2 MB text pages have at most about 2% to offer.
With PGO and ThinLTO (the PGO post’s build, a newer commit) the frontend-bound share falls 19 to 23 points and misses halve; 36% to 53% stays frontend bound.
How we measured
The method is the price list’s: paired rounds, a fixed open-loop rate, cycles counted on the proxy alone, and a validity gate that fails closed. Specific to this study:
- One machine. A 2016 dual-socket Xeon E5-2673 v4 server at a fixed 2.3 GHz, turbo off, Ubuntu 24.04, kernel 6.8. Envoy ran 4 workers on 4 cores of one socket, hyperthread siblings idle; Nighthawk and an nginx origin ran on the other socket, over loopback. At a fixed rate the faster builds are less busy: 19% to 38% across builds and shapes, with some header-heavy legs as low as 6%. (The author of this post is an emeritus maintainer of Nighthawk.)
- The metric. User plus kernel cycles on the Envoy process per response. Each leg also counted one of two event groups, alternating by round, with no counter multiplexing.
- Builds. Tag v1.40.2, Bazel 8.8.1, Envoy’s hermetic clang 22.1.8, the release options (
-c opt --stripopt=--strip-all --linkopt=-Wl,--compress-debug-sections=zlib) plus each tool’s flags. PGO + ThinLTO used the PGO post’s nine-leg training mix. Every binary is SHA-256 pinned. - Rounds and an A/A pair. Each round runs every arm once per shape, one paired ratio per comparison. Each session also ran a second copy of its reference binary as if it were another build (an A/A pair); its point estimate must land within about ±1%, or the run is invalid. Session one: six arms, three shapes, six rounds, 108 legs. Session two: six arms,
sonly, six rounds, 36 scored legs. All legs were valid. - Intervals. The effect is the mean paired log ratio, as a percent. The interval is the wider of the t interval (5 degrees of freedom) and
1.96 x sqrt(SE² + 0.34²), where 0.34% is the offset each session carries, from earlier work (two sessions differ by about 0.48%). - Lines set before each session:
| Tool | Dropped if |
|---|---|
| Ordering file | under 3% fewer cycles than release on s and on fh |
| AutoFDO | keeps under half of the PGO gain on s and fh |
| BOLT | under 1.5% fewer cycles than PGO + ThinLTO on two of three shapes; in session two, against its relinked input |
| AutoFDO plus ordering file (session two) | under 3% fewer cycles than AutoFDO |
- Profiles. Branch-record samples (Intel LBR,
perf record -b) on the three shapes: for the ordering file, three 20-second recordings of the official binary; for AutoFDO, a later, denser recording of it (a first build from the thinner one was not measured); for BOLT, a recording of its own input. PGO’s training mix covers thesandfhroutes but not the headersfladds. - A second analysis recomputed every number from the raw records and checked pins, counter running times and disturbance (at most 0.09% of the proxy’s cores used by other tasks).
Where the run departed from the plan
The A/A broke its line once. In session one the two copies of the release binary read −1.20% apart on fh [−2.16, −0.23], the second copy lower in all six rounds. By our rule the fh column is invalid (“no verdict”), so the two drop rules naming s and fh cannot be applied as written. The ordering file is kept on s alone (lower bound 7.79% against 3%). AutoFDO we read on s (42%, upper end 44%), with fl agreeing; with the other copy as the reference its fh share is lower than the 48% printed, so the bias did not push it under the line. Every effect a decision rests on is at least 4.7 times the bias. The likely cause is our cyclic Latin square, in which the second copy always ran right after the first.
Session two used a Williams square, in which every arm follows every other arm exactly once, plus an unscored warm-up leg per round. Its A/A read +0.20% [−1.52, +1.95]: the point passed, which fits the carryover explanation without proving it. This session was noisier (round means from −1.6% to +1.9%, against ±0.4%), so its intervals are wider.
BOLT’s input was not what the plan said. The plan required the --emit-relocs relink BOLT needs to leave the code identical to the PGO binary’s. Instead lld placed .eh_frame before .rodata, which moved .rodata and changed 1% of the code bytes (RIP-relative displacements); function addresses and symbols stayed the same. Session one’s BOLT figures include that move; session two measured the relinked binary on its own and read BOLT against it.
The BOLT rule did not say what it applies to. “Under 1.5%: drop it” did not say point or interval. On the point, 4.05%, BOLT stays; the interval’s near end, 0.29%, is under the line. Future plans will name which one each line, the A/A gate included, applies to.
The results in full
Session one: six arms, three shapes
Mean paired change in cycles per response, 95% interval, and the rounds in which the first arm used fewer cycles.
| Comparison | s |
fh (no verdict) |
fl |
|---|---|---|---|
| A/A: release against itself | −0.22% [−1.39, +0.96], 4/6 | −1.20% [−2.16, −0.23], 6/6 | −0.58% [−1.40, +0.24], 6/6 |
| Ordering file against release | −9.61% [−11.38, −7.79], 6/6 | −9.09% [−11.61, −6.50], 6/6 | −7.19% [−9.46, −4.86], 6/6 |
| AutoFDO + ThinLTO against release | −16.77% [−17.62, −15.91], 6/6 | −17.37% [−18.31, −16.42], 6/6 | −15.37% [−16.12, −14.61], 6/6 |
| PGO + ThinLTO against release | −39.75% [−40.53, −38.97], 6/6 | −36.49% [−37.19, −35.78], 6/6 | −36.21% [−37.45, −34.94], 6/6 |
| BOLT against PGO + ThinLTO, relink included | −7.16% [−10.53, −3.65], 6/6 | −6.26% [−8.89, −3.56], 6/6 | −5.62% [−8.64, −2.50], 6/6 |
PGO + ThinLTO landed inside the validity band set for it (−35% to −45% on s). The ordering file is kept: lower ends 7.79% on s and 4.86% on fl, against 3%. BOLT is kept in this session, but its lower bounds include the relink.
AutoFDO is under the line, for this configuration: --ignore-stack-samples, no -fdebug-info-for-profiling, each profile leg 1.2 to 2.1 times thinner than llvm-profgen asked for (the merged profile was not re-checked), and a split-DWARF package that lacked debug data for 234 modules in the first profile, costing inline context. With no ThinLTO-only arm, ThinLTO’s part of the gain is unknown.
Session two: BOLT’s input, and AutoFDO plus the ordering file
Shape s, six rounds in a Williams square. In every row the t interval was the wider.
| Comparison | Effect | Interval | Rounds won |
|---|---|---|---|
| A/A: PGO + ThinLTO against itself | +0.20% | [−1.52, +1.95] | 3/6 |
--emit-relocs relink against PGO + ThinLTO |
−1.12% | [−3.47, +1.29] | 4/6 |
| BOLT against the relinked binary | −4.05% | [−7.66, −0.29] | 6/6 |
| BOLT against PGO + ThinLTO | −5.12% | [−8.38, −1.74] | 5/6 |
| AutoFDO plus ordering file against AutoFDO | −4.70% | [−6.06, −3.32] | 6/6 |
The relink reading is not resolved; most of it is kernel cycles, and the user-space counters stayed within 1%.
BOLT. On s, pooling both sessions (weighted by precision) minus the unresolved relink gives about 5% fewer total cycles, roughly 2.5% to 7.5%. Against a plain PGO + ThinLTO build (the operator’s comparison, since the relink comes with BOLT) it is −6.1% [−7.9, −4.2]. Neither pooling was stated before the runs. The user-space cut, 11% to 12.5%, agrees across sessions; the total is imprecise because kernel cycles, over half of it, moved −2.2% and +0.7% in the two sessions, unattributed. fh and fl (6.3%, 5.6% in session one) include the relink.
AutoFDO plus the ordering file. The 4.7% clears its 3% line with the whole interval. Chained through session one’s PGO ratio on s, it brings AutoFDO to 52.7% [48.4, 57.0] of the PGO gain; AutoFDO alone, chained the same way, comes to 43% (42% measured directly). The interval includes 50%, so this does not overturn the AutoFDO result; that would need a direct run against PGO + ThinLTO.
What the counters say
User space, per response, s, session one; instructions and cycles are six-round means, the other rows three-round means.
| Release | Ordering file | AutoFDO | PGO + ThinLTO | BOLT on PGO | |
|---|---|---|---|---|---|
| Instructions | 163.8k | 163.9k | 136.4k | 119.9k | 119.6k |
| User cycles | 345.7k | 297.3k | 261.9k | 152.3k | 133.2k |
| Kernel cycles | 180.1k | 178.0k | 175.8k | 164.5k | 161.0k |
| Frontend bound | 74.1% | 69.5% | 71.4% | 55.1% | 47.6% |
| Instruction-cache misses | 7,963 | 5,794 | 5,660 | 3,642 | 2,771 |
| Front-end resteers (BAClears) | 8,329 | 8,026 | 6,117 | 1,973 | 1,489 |
- The ordering file is placement only. Same instructions; 25% to 27% fewer instruction-cache misses across the shapes, about half of PGO’s 51% to 54%; 28% to 31% fewer stall cycles; resteers barely move. It saves 14% of user cycles on
s, less of the total because its kernel cycles (29% to 55% of the total across arms) hardly change. - AutoFDO removes about as many misses (28% to 29%), plus 16% to 17% of the instructions and 26% to 32% of the resteers. The ordering file added less on top of AutoFDO (misses −8.3% against −27%). Three explanations fit, none resolved: the two may remove the same misses; the file packed AutoFDO’s hot code less well (315 to 204 pages, against 306 to 123); and lld warned 887 times that it could not find or place an entry, mostly names ThinLTO had renamed or removed.
- PGO + ThinLTO removes 23% to 27% of the instructions, 51% to 54% of the misses and 75.6% to 77.7% of the resteers, and cut kernel cycles by about 9% on
s, for reasons not established. BOLT on top keeps the instructions and removes about another quarter of the misses.
The release build reproduces the earlier counter run within 1.5% on every count. An ordering file gets about half of PGO’s drop in instruction-cache misses without changing which instructions run, but that is not a clean split of PGO’s gain into layout and the rest, for the reason below.
What AutoFDO, BOLT and an ordering file cost to adopt
What the ordering file replaced. lld sorts functions by default (cdsort) from .llvm.call-graph-profile sections that clang writes for functions with profile counts; the release build has none. Given --call-graph-ordering-file, lld 22 reads that file instead of those sections. So the PGO and AutoFDO builds most likely had a function order of their own, which ours replaced in the AutoFDO-plus-file arm. We did not inspect the objects (the build tree is gone); in the AutoFDO binary the release build’s hottest functions still spread over 315 pages, against 306, so whatever order it had did not pack them. A --symbol-ordering-file differs: lld places its symbols first and uses the call graph for the rest; we did not test it.
The ordering file lists caller, callee and count (2,554 edges here) from branch records that land on a function entry. Over the functions carrying 90% of the release build’s branch weight, hot code shrank from 306 to 123 4 KB pages. It needs one section per function, which Envoy’s -c opt objects have, and a profile of a binary you can symbolize: the unstripped twin from the same link. It is only a relink, because --linkopt reaches the final link alone: 2 minutes here, but only with the object tree of a 72-minute cold build still cached. lld skips names it cannot find, so a stale file degrades towards the default order rather than failing.
AutoFDO (llvm-profgen, then clang’s -fprofile-sample-use, which as a --copt also reaches the dependencies) needs a full ThinLTO rebuild, a dense enough profile, the profiled build’s split-DWARF package, and -Wno-backend-plugin: Envoy builds with -Werror, and the sample loader reports profile mismatches as backend diagnostics. That flag silences every backend diagnostic. No instrumented build or training harness.
BOLT needs an --emit-relocs input (another link, which here changed code bytes) and one more profiling pass on it. tcmalloc’s restartable sequences (rseq) must not move, so we skipped tcmalloc and the allocator entry points (-skip-funcs takes anchored regular expressions); we did not check every rseq critical section against that list. Identical-code folding (-icf=1) can make a stack trace show a folded twin’s name.
Binary sizes (MB of 10⁶ bytes, stripped, .text in brackets): release and ordering file 106.9 (68.2), AutoFDO with or without the file 111.3 (74.7), PGO + ThinLTO 103.9 (65.7). The measured BOLT binary is 203.7, not stripped: it keeps 72 MB of symbol tables and the original 65.7 MB of code, with the profiled code moved into 0.9 MB of new sections. We did not measure a stripped one.
Debug information. The ordering file changes nothing for debugging; AutoFDO behaves as PGO does. BOLT’s input was stripped with llvm-objcopy --strip-debug, and llvm-bolt drops debug info without -update-debug-sections (not used), so the BOLT binary has symbols but no debug info, and line-level symbolization against the PGO build’s debug files would be wrong.
Build caching. Bazel does not track files named only inside --copt or --linkopt: regenerate the call-graph file or .afdo profile at the same path and Bazel can reuse stale work without warning, so put the content hash in the file name. --fdo_optimize avoids this for PGO; we did not try it for AutoFDO.
Reproducibility and hardware. A checked-in profile keeps the build reproducible: rebuilt from scratch with the same profile, the AutoFDO binary matched byte for byte. Only profile collection needs branch records; check that perf record -b works on your machines. llvm-profgen and llvm-bolt are not in Envoy’s hermetic toolchain; we used the official LLVM 22.1.8 release, the compiler’s version.
The PGO + ThinLTO costs are in the PGO post.
On Arm
We repeated part of the study on a 16-vCPU cloud VM on Neoverse V2 cores and a bare-metal server with 96 Neoverse N3 cores, against the official arm64 v1.40.2 release, to which our plain build was byte-identical. Both ran 4 workers on loopback with client and origin on the same host, all shapes at 5,200 requests/s (so fh is not the x86 fh), low load, Williams order: 10 rounds on the VM, 14 on bare metal, every leg valid, the A/A within its gate. Machines, profile sources and rates differ from x86, so this is not a controlled comparison between architectures, and the two Arm machines (different cores, VM against bare metal) are not compared with each other either: each row compares builds on one host.
| Comparison | s |
fh |
fl |
|---|---|---|---|
| VM, Neoverse V2: PGO + ThinLTO against release | −38.22% [−39.15, −37.28] | −33.68% [−34.58, −32.76] | −35.49% [−36.20, −34.77] |
-mcpu=neoverse-v2 on top of PGO + ThinLTO |
+0.35% [−1.47, +2.20] | −2.51% [−4.81, −0.16] | +0.10% [−2.28, +2.53] |
| Bare metal, Neoverse N3: our byte-identical build as a separate file, against release | +0.47% [−0.57, +1.52] | +0.38% [−0.72, +1.49] | −0.74% [−2.17, +0.70] |
| Ordering file against that file | −6.67% [−7.59, −5.74] | −4.30% [−5.30, −3.29] | −6.70% [−7.66, −5.74] |
| PGO + ThinLTO against release | −38.26% [−38.85, −37.67] | −27.78% [−28.45, −27.10] | −35.40% [−36.31, −34.48] |
| AutoFDO + ThinLTO against release | −15.51% [−16.37, −14.63] | −15.89% [−16.59, −15.20] | −15.99% [−17.33, −14.63] |
| BOLT on PGO + ThinLTO against PGO + ThinLTO | −0.12% [−0.91, +0.68] | +0.01% [−0.78, +0.82] | −0.64% [−1.42, +0.15] |
- PGO + ThinLTO: 34% to 38% fewer cycles on the VM and 28% to 38% on bare metal, each against the release on that host; the two ranges come from different cores and machine types and are not a comparison between them. Tuning for the core (
-mcpu=neoverse-v2) on top gave no resolved difference on any shape (thefhinterval does not clear that shape’s 1.9% A/A floor), and such a binary may not run on older Arm cores. - The ordering file on bare metal: 4% to 7% fewer cycles than our byte-identical build run as a separate file, which itself shows no file effect (within about ±1.5% to 2.2%), so the gain is layout; on
fhthe lower end, 3.29%, is close to the 3% line. The VM’s ordering-file figure is in the released data, but we do not quote it as a result: there the two binaries were different files created in different ways, and the control (our byte-identical build run as a separate file, where no effect is expected) was not run on that host. On bare metal that control read null and the gain was 4% to 7%. - AutoFDO used about 16% fewer cycles on every shape, 41% to 57% of the PGO gain (41% on
s, 57% onfh, 45% onfl). The profile came from the core’s Statistical Profiling Extension (SPE) throughcreate_llvm_proffrom the open-source AutoFDO project (google/autofdo on GitHub), becausellvm-profgencould not use SPE’s records. The high end rests onfh, where PGO’s gain on this machine was smallest; AutoFDO’s own gain was flat. Tool, branch source and core differ from x86, so the shares are not comparable; the x86 configuration caveats apply. - BOLT with a profile from SPE samples gave no gain of 1.5% or more (at most 0.8% to 1.4%, the interval ends). The profile covered 300 functions, about as many as x86’s 313, so its breadth was not the problem; its shape was. SPE records one taken branch per sample and no fall-through paths, so BOLT found the profile’s control flow 100% discontinuous (it could not join the sampled edges into paths through a function), against 3.3% with x86 branch records. PGO + ThinLTO also leaves little frontend stall here (9% to 17% of user cycles). This is about that profile source; BOLT with a branch-history profile on Arm was not tested (this server reported no BRBE, Arm’s branch-record feature).
- Profile provenance. AutoFDO and BOLT were profiled on the bare-metal machine on the measured shapes. The ordering file (frame-pointer perf samples) and the PGO training came from the VM, PGO on its own mix. That favours AutoFDO’s share and BOLT, and at worst works against the ordering file. One departure: the plan’s check that PGO land within 5 points of the VM figure became a reading, ruled while the profiling legs ran (on the core identity found before any leg); read per shape, it would have tripped on
fh(the plan’s original wording of the check is not preserved), and onsit passes.
The Arm configurations, scripts and data are public in the harness repository at the tag waves-2026-11c: the study’s notes for the cloud VM and for the bare-metal server, the Arm build scripts, and the data as assets of the release (cloud VM, bare metal).
A PGO profile from Envoy’s own tests
A PGO + ThinLTO build whose profile needs no traffic trainer, load generator or origin still used about 16% to 17% fewer CPU cycles per request than the official binary. The profile came from 12 integration and 10 benchmark tests of Envoy’s own suite. Built with it, v1.40.2 used 17% fewer CPU cycles per request than the official binary on s and 16% fewer on fh.
That is 44% to 45% of the gain of the traffic-trained profile on the same two shapes (40% and 34% in this session). Before the run we set the bar for replacing a traffic-trained profile at half of its gain, and the tests profile kept less, in simple percent or in log points (37.6% and 40.4% computed from log effects). The comparison flatters the traffic profile, which was trained on the same two shapes it is scored on here; the tests profile was not. The two profiles share 21% of their edge weight.
PGO + ThinLTO builds of v1.40.2, each against the official binary:
| Profile | s, 5,200/s |
fh, 8,000/s |
Basis |
|---|---|---|---|
| Traffic trainer | −39.56% [−40.29, −38.82] | −34.40% [−35.60, −33.18] | Measured |
| Envoy’s own tests | −17.26% [−17.96, −16.56] | −15.65% [−16.89, −14.39] | Measured |
| Tests profile’s share of the traffic-trained gain, from the medians of cycles per request | 44.0% | 45.4% | Measured; under the bar |
| Integration tests only | −16.32% [−17.30, −15.34] | −15.20% [−16.60, −13.78] | Measured in a follow-up session without an A/A run of its own; under the bar |
- The traffic-trainer profile was trained on the two measured shapes.
- The tests profile came from 12 integration and 10 benchmark tests of Envoy’s own suite; the integration-tests-only profile came from the 12 integration tests alone.
- Our bar for the share was 50%, set before the run.
Conditions: one session on 23 November 2026 on the x86 server, 8 rounds in a balanced order, the same build options for both profiles. A/A: −0.36% [−1.13, +0.41] on s and −0.18% [−1.69, +1.36] on fh; both passed. There is one tests profile: IPv4 only, with one test shard lost in the profile run. The tests build carries one diagnostics option on one file that the trainer build does not. One departure from our plan: it forbids a login on the machine during measured runs, and an interactive session stayed open on the machine during the runs; other tasks used at most 0.003 of a CPU on the proxy’s cores in any run, and we kept the rows. The integration-tests-only row comes from a second session on the same day with the same design, the same three builds repeated and no A/A run of its own.
The traffic-trained build repeats session one’s figure on s (−39.6% here, −39.8% there). On fh it measured −34.4% here against −36.5% there; session one’s same-build check on that shape was off by 1.2%, and the method of the price list already says that header-heavy results from it carry no verdict.
A profile from the 12 integration tests alone, measured in a follow-up session the same day, kept 42% of the traffic-trained gain on the proxied shape and 45% on the header-heavy direct response (36% and 39% computed from log effects), against the traffic-trained build measured in the same session. That is also under the bar, and it did not differ from the full tests profile by more than that session could resolve (+1.20% [+0.12, +2.29] on the proxied shape, −0.71% [−2.81, +1.44] on the header-heavy direct response). The traffic trainer and the build recipe are in the PGO post. The data for this section is in the harness repository at tag waves-2026-11d: the configurations in examples/wave7s4 and examples/wave7s4b, the run notes in docs/wave-studies.md (integration tests only) and the raw data in the release archives waves-2026-11d-data-tracing-tests-profile.tar.gz and waves-2026-11d-data-tests-profile-integration.tar.gz (checksums in SHA256SUMS).
What we did not test
- Unseen traffic (all sampled profiles came from the measured shapes), and a ThinLTO-only arm.
- Other AutoFDO setups:
-fdebug-info-for-profiling,-funique-internal-linkage-names, a denser profile, a complete split-DWARF package, context-sensitive profiles,--fdo_optimize. - More arms: AutoFDO plus the ordering file against PGO directly or on
fhandfl; BOLT onfhandflagainst its relinked input, on the release build or on AutoFDO, stripped; Propeller; profiles from another commit; huge pages for the text segment. - Other hardware and load. On x86, one Broadwell part, whose front end is older than current server cores, so the shares may differ there; no AMD branch records. Loopback, 6% to 38% busy, 4 workers, three HTTP/1 shapes; no TLS, HTTP/2, HTTP/3 or gRPC. On Arm, only what the section above lists.
- Tests. No Envoy test suite ran on these builds; each served a short smoke of traffic with only 2xx responses.
How to reproduce it
The build and analysis scripts, harness configurations and raw per-leg records are public in the harness repository at the tag waves-2026-11: the study’s notes, with every binary’s SHA-256, the build scripts, and the data as assets of the release (code layout, top-down counters). The scripts run these steps:
- Release build of
envoy-static.stripped,envoy-staticandenvoy-static.dwp; check the stripped binary against the release digest. The script confirms one section per function. - Branch records. For the ordering file, one 20-second
perf record -b -gwindow per shape of retired taken branches in user space (cpu/event=0xc4,umask=0x20,period=100003/upp) pluscycles:u; for AutoFDO and BOLT, that event alone at period 20,003, two 30-second legs per shape (recording wrapper). - Ordering file. From
perf script --show-mmap-events -F ip,brstack, our script writes caller, callee and count for calls that land on a function entry (lbr2order.py). Relink with--linkopt=-Wl,--call-graph-ordering-file=cg.txt --linkopt=-Wl,--call-graph-profile-sort=cdsort(the second flag is lld’s default; the script passes it explicitly). - AutoFDO.
llvm-profgen --format=extbinary --ignore-stack-samples --dwp=<package>reads each leg’sperf scriptoutput (--perfscript), with the unstripped binary copied to the profiled file’s name, which it matches on. Merge withllvm-profdata merge --sample --extbinary, then rebuild with--features=thin_lto --ltobackendopt=-Wno-unused-command-line-argument --copt=-fprofile-sample-use=<profile> --copt=-Wno-backend-plugin. For AutoFDO plus the ordering file, relink those objects with the step 3 flags. - BOLT. Build PGO + ThinLTO as in the PGO post, relink with
--linkopt=-Wl,--emit-relocs, runllvm-objcopy --strip-debug, and record it as in step 2.perf2boltalso matches by file name, so its copy gets the profiled file’s name. Thenmerge-fdataandllvm-bolt -reorder-blocks=ext-tsp -reorder-functions=cdsort -split-functions -split-all-cold -split-eh -icf=1 -skip-funcs='.*tcmalloc.*,malloc.*,free.*,calloc.*,realloc.*,_Zn[wa].*,_Zd[la].*'(bolt.sh). - Measure in a balanced order with an A/A copy in every run (configurations
w2.jsonandw2b.json; binary pins inbins.json).
If you reproduce this, post what you get as an issue on the A/B harness.
Credit
None of these tools are ours: function ordering is lld’s, the sample-profile pipeline and BOLT are LLVM’s, create_llvm_prof is the open-source AutoFDO project’s, and the branch records come through Linux perf. The measurements, the scripts and any error in them are ours.