Envoy performance · part 7 of 12
Find the CPU in your Envoy config: a priced checklist
By Otto van der Schaaf, We-Amp · · updated
This is a checklist of Envoy configuration settings, each with the CPU it costs per request on one test machine, what it buys you, and what to try. On that machine, ten HTTP filters that take no action on the traffic cost +9.5% CPU per request, an OpenTelemetry tracer at 0% sampling cost +6.7%, and a compressor that compresses nothing cost +5.3%. In a later session, disabling the same ten filters per route cut CPU per request by 8.67%, measured against those filters enabled.
A price is the change in the proxy’s CPU per request (user and kernel cycles on the proxy process, divided by the responses it served) at a fixed request rate, against the configuration named in the row, usually the same proxy without the setting. Every figure is from one 2016 two-socket x86-64 server over loopback, the official Envoy v1.40.2 release binary, 4 workers, HTTP/1.1 and 4 KB proxied responses unless the row says otherwise. The settings are the same whether Envoy runs at the edge or as a sidecar; each price is for one proxy. A price holds for this shape; check what this does not cover before you apply one to your own traffic. The price list has the full conditions of each checklist row, the conditions of the ten later rows are below, and Envoy performance, measured has the method.
Contents
- Which Envoy settings cost the most CPU?
- Why does Envoy spend CPU on features that do nothing?
- Do the prices add up?
- What do ten more settings cost?
- How do I find the CPU cost of my own Envoy config?
- What does this checklist not cover?
Which Envoy settings cost the most CPU?
Of the items below, JWT authentication that verifies every token, 100% trace sampling and a 4 KiB buffer limit on 16 KB responses cost the most, each over 20% per request; the rest cost between 1.5% and 9.5%. Every row links to its section of the price list. The Case column says which case of the price list’s rule (quoted below) each figure is, with the price list’s own qualifiers.
| Item | CPU per request [95% interval] | Case | What it buys | What to try |
|---|---|---|---|---|
| OpenTelemetry tracer, 0% sampling | +6.7% [+6.2, +7.3] | over 2% | Trace context propagation for every request | If nothing downstream relies on this proxy for trace context, remove the tracer; at 0% sampling it still costs this |
| The same tracer, 1% / 100% sampling, exporter at its defaults | +7.0% [+6.5, +7.5] / +33.8% [+33.2, +34.3] | over 2% / over 2%, a lower bound | Traces | Sample only as much as you look at; below a few percent, most of the cost is paid on every request |
| File access log, default text format / JSON (15 fields) | +3.6% [+2.7, +4.5] / +4.5% [+3.8, +5.2] | over 2% | A record per request | Log what you read. In our runs JSON with 15 fields cost about a point more than the default text format (not measured as a direct comparison) |
| Ten HTTP filters that take no action on the traffic | +9.50% [+8.48, +10.53] | over 2% | Nothing on this traffic | disabled: true on each entry: with it we could not tell the chain from one without the filters. Disabling them per route is priced below, against the same filters enabled |
| A gzip compressor filter that compresses nothing (content type not in its list) | +5.3% [+4.7, +5.8] | over 2% | Nothing on this traffic | Scope the filter to the routes that serve compressible types. Disabling it per route is priced below, against the compressor enabled |
| Default idle timeouts (stream 5 min, downstream connection 1 h), against both set to 0 | +2.3% [+1.9, +2.7] | over 2% | Protection against stuck clients and leaked connections | Keep them; the row records what they cost |
| Retry policy configured, no retries triggered | +1.5% [+0.9, +2.2] | between 1% and 2%; with the between-session spread added the interval is [+0.6, +2.4]; near the floor | Retries when you need them | Keep it; the price is close to the smallest effect we resolve |
| Local rate limit, enforced on every request, never triggered | +1.9% [+1.3, +2.6] | between 1% and 2%; with the between-session spread added the interval is [+1.0, +2.8]; near the floor | Protection | Keep it where it protects something |
| JWT authentication, RS256 with one RSA-2048 key in a local JWKS: verifying every token / with the token cache hitting | +32.1% [+31.5, +32.6] / +4.3% [+3.9, +4.7] | over 2%, a lower bound / over 2%, the cache’s best case | Authentication | Turn on the token cache (jwt_cache_config; without it there is no cache) and size it for your distinct tokens. With more distinct tokens than the cache holds, expect at least the price of verifying every token |
| Per-connection buffer limit of 4 KiB, against the 1 MiB default, 16 KB responses | +20.6% [+20.0, +21.1] | over 2% | A memory bound per connection | If you lowered it from the 1 MiB default, keep it above your common response size |
Two rows are lower bounds: 100% sampling and JWT verifying every token. At the same request rate, those legs kept the cores busier than the reference did. On this machine a busier core spends less CPU per request, so those prices are probably understated. The JWT cache row is the cache’s best case: one token in use, so every request was a hit.
Your filter chain will not match these rows one for one. To have your own configuration priced the same way on your traffic, see Envoy performance consulting.
Why does Envoy spend CPU on features that do nothing?
A configured feature does some work on every request, even when it changes nothing about the response. Four rows above are examples: the compressor, the tracer at 0% sampling, the ten filters and the idle timers. Each is easy to forget, because nothing in the output shows it.
Some of these are worth keeping. The idle timers protect the proxy: Envoy’s API reference warns against disabling the connection idle timeout, and its timeouts guide recommends keeping the stream idle timeout. A filter that one route needs but that runs on every request is worth a look. Set disabled: true on its entry in the HTTP connection manager (HCM), and enable it again on the routes that need it through the route’s typed_per_filter_config, with a FilterConfig that leaves disabled false. We did not price the per-route enabled path.
Do the prices add up?
For these six features together (a JSON access log, the tracer at 1%, a compressor that does not compress, JWT with its cache hitting, a local rate limit and a retry policy), the six single prices sum to +24.5%, and the six together measured +22.93% [+21.77, +24.09], within 3 points of the sum. They are the first row of the price list’s stack table. That was one stack in one session. The same table adds a seventh feature, and for that stack the sum did not hold.
What do ten more settings cost?
A later session priced ten more settings on the same shape (HTTP/1.1, 4 KB proxied responses), the same binary and 4 workers, over loopback. The legs ran in separate Envoy processes, paired across restarts, an identical-configuration (A/A) run came first, and the comparisons were fixed before the session began. Every row is Measured (pre-registered).
The Case column applies the price list’s rule: “An effect under about 1% from one run is not a finding, whatever its own interval says. An effect between 1% and 2% needs a second session, or an interval that still excludes zero once the between-session spread is added.” The intervals below are widened that way: each is the 95% interval with the between-session spread added. Figures here are given to two decimals. The four header rows buy whatever reads those headers, so send only the ones something reads.
How the ten were chosen: 19 settings were screened, 15 in an in-process loop and 4 in a restart screen (steering only); the 10 rows below were then measured between processes in one pre-registered session. A screened setting not listed here was not measured in this session; where the price list already has a row for it, that row stands; otherwise no claim is made about its cost. The screens were quick runs used only to choose what to measure, so this post quotes none of their readings.
| Setting | Compared with | CPU per request [95% interval, widened] | Case | What it buys or costs |
|---|---|---|---|---|
The same ten HTTP filters that take no action, disabled: true per route |
the same ten filters enabled | −8.67% [−9.33, −8.01] | over 2% | The filters stop running on those routes; keep them on the routes that need them |
| 20 constant response headers | no added headers | +4.15% [+3.39, +4.91] | over 2% | 20 fixed headers on every response |
A compressor that compresses nothing (content type not in its list), disabled: true per route |
the compressor enabled | −3.12% [−3.85, −2.39] | over 2% | The compressor stops running on those routes; keep it on the routes that need it |
Router dynamic_stats: false |
the default | −2.92% [−3.65, −2.19] | over 2% | – |
| 5 formatted request headers | no added headers | +2.50% [+1.76, +3.25] | over 2% | 5 values formatted per request and sent to the upstream |
| 10 constant response headers | no added headers | +2.33% [+1.58, +3.08] | over 2% | 10 fixed headers on every response |
| 5 constant response headers | no added headers | +1.36% [+0.61, +2.11] | between 1% and 2%, widened interval excludes zero (the page’s second clause) | 5 fixed headers on every response |
Route timeout: 0s |
the default timeout (15 s) | −1.24% [−1.96, −0.52] | between 1% and 2%, widened interval excludes zero (the page’s second clause) | Removes the route’s 15 s request timeout: a request to a stalled upstream is then bounded only by the idle timeouts, if set. Keep a timeout on routes to upstreams you do not control |
Route stat_prefix |
no route stats | +0.73% [+0.01, +1.45] | under about 1% from one session: not a finding by this page’s rule | – |
stats_matcher inclusion list |
no inclusion list | +0.19% [−0.54, +0.94] | no difference resolved | – |
What the store’s stats, the stats sinks and the flush cost is measured in the stats post, including how the dynamic_stats row differs from rejecting every stat.
Two rows price a mitigation. The filters row disables, per route, the same ten filters as the price list’s row, against those filters enabled. The price list’s row for disabled: true at the HCM level is a different contrast: the ten filters with disabled: true at the HCM level, against no filters. The compressor row disables the compressor per route, against the compressor enabled; the price of the compressor itself stays the +5.3% in the checklist above. In the Case column, “this page” and “the page” mean the price list.
The 20-header row was measured again the day after the table’s session, at three request rates. On 30 November 2026, at 5,200 req/s in 18 rounds, the same comparison measured +4.16% [+3.16, +5.17], beside the +4.15% [+3.39, +4.91] in the table. The two figures are not pooled. The same session measured +3.23% [+2.37, +4.09] at 2,560 req/s and +4.41% [+3.59, +5.25] at 7,808 req/s, each over 2%, from one session. Whether the cost changed between those two rates is a row of its own, with its own case, in Envoy CPU per request under load: does a price hold at every request rate?.
How do I find the CPU cost of my own Envoy config?
To price your own configuration:
- List every HTTP filter in each listener’s chain, the access logs and their formats, the tracer and its sampling, and any per-request header work.
- For each item, find the nearest row above and check that its conditions match yours: protocol, body size, TLS.
- For anything that matters, measure it on your own traffic: the same proxy with and without the item, at a fixed request rate, several rounds in alternating order, and a same-configuration run to see your noise floor.
The harness we use is public: github.com/We-Amp/envoy-price-list, with a worked example for the tracing row in the price list. The raw records for the ten later rows are assets of the release, with checksums.
What does this checklist not cover?
- Other reference proxies. Most percentages are relative to a lean reference: a router-only proxy at about 525k cycles per request on this server. The buffer row’s reference serves 16 KB responses, and the two per-route rows in the second table are against the filters or the compressor enabled. In a configuration that already does more work per request, the same added cost is a smaller share, so these percentages overstate it there. Compare absolute CPU time where you can.
- Other Envoy versions, other machines and real traffic. Every row is one Envoy version (v1.40.2), one machine, synthetic traffic from a load generator over loopback, and 4 workers. Costs can move between releases.
- TLS, HTTP/2 and HTTP/3, which change the reference and therefore every percentage.
- The cost of the side services (collectors, authorization services); only Envoy’s own CPU is priced.
- What you lose by turning something off. Where a row says what a setting buys, check that against what you use.