At GetYourGuide, requests from the internet pass through an Istio ingress gateway with a Go sidecar in the same pod. The sidecar speaks Envoy’s External Processing protocol (ext_proc) over a unix domain socket, so no network sits between Envoy and the filters, and it runs a chain of filters for header normalization, request enrichment, security checks and observability.
Envoy now supports dynamic modules: shared libraries loaded into the Envoy process, with an official Go SDK. Our interest is mostly about routing. In-process, a filter can set headers that feed the routing decision and pick the destination directly, without rewriting request properties such as the Host header. That opens up routing use cases that are awkward to build over ext_proc.
Before going further, we wanted to know what it would cost us: can the same filters run in-process without a rewrite, and how do they perform? We ran the whole investigation with Claude in an afternoon. Analysis like this used to be a project; now it’s cheap enough to do before every decision of this kind.
Scope: one comparison among many Link to heading
Envoy can be extended in several ways, and each makes different trade-offs:
- Native C++ filters, compiled into Envoy itself. They are the fastest option, but you build and maintain a custom Envoy.
- Lua, for small inline scripts. It is easy to start with, but limited for larger logic.
- Wasm (proxy-wasm), for sandboxed plugins in several languages. Isolation comes at a performance cost.
- ext_proc, a separate gRPC service in any language, reached over TCP or a unix socket. It is fully isolated, at the cost of an extra hop per request.
- The Go filter (
envoy.filters.http.golang), Go running in-process through cgo. - Dynamic modules, shared libraries with SDKs for Rust, Go and C++.
This post compares only two of them: ext_proc written in Go and a Go dynamic module, running the same filter code. The numbers and trade-offs below apply to that pair. Other options, or the same options in another language, behave differently.
The adapter Link to heading
Our filters implement a small, transport-agnostic interface from extproc-go: read headers from a request context, record mutations on a response writer, optionally return an immediate response.
The Envoy Go SDK has its own shared.HttpFilter interface. A thin adapter of about 150 lines bridges the two. On each callback it copies Envoy’s headers into our request context, runs the existing chain, replays the recorded mutations onto Envoy’s HeaderMap, and turns an immediate response into SendLocalResponse. The same code now builds into the gRPC sidecar and into a library Envoy loads:
func init() {
sdk.RegisterHttpFilterConfigFactories(map[string]shared.HttpFilterConfigFactory{
"edge-filters": &configFactory{},
})
}
func main() {} // built with: go build -buildmode=c-shared
Identical requests through both runtimes produced response headers and rejections.
Run the chain async, not on Envoy’s workers Link to heading
Dynamic module callbacks run on Envoy’s worker threads, the same threads that proxy every other request. Running the chain directly in the callback (sync) is the simplest and cheapest option, but any slow filter then blocks the worker. The alternative pauses the stream, runs the chain on a goroutine and resumes on the worker through the SDK’s scheduler:
sched := handle.GetScheduler()
go func() {
res := runChain()
sched.Schedule(func() {
applyMutations(res)
handle.ContinueRequest()
})
}()
return shared.HeadersStatusStopAllAndBuffer
Results Link to heading
We ran ext_proc, sync and async side by side in one Envoy on an isolated test cluster. Envoy was the binary from Istio’s proxy image, with 4 worker threads and up to 8 CPUs. The ext_proc sidecar had its own 8 CPUs and talked to Envoy over a unix socket, as in our gateway, and the load generator (fortio) ran on another node.
There were three chains:
- noop: transport cost only.
- realistic: our CPU-bound filters, mostly header work and policy evaluation.
- +1 ms I/O: realistic plus a filter that blocks for 1 ms, like a datastore call.
These numbers describe the lab, not production capacity.
Hover or tap a row to see all numbers for that setup.
All numbers
| Chain | Runtime | p50 | p99 | CPU / request | Max rps |
|---|---|---|---|---|---|
| noop | ext_proc | 3.27 ms | 4.85 ms | 493 µs | 14,563 |
| noop | sync | 2.31 ms | 3.42 ms | 255 µs | 23,667 |
| noop | async | 2.32 ms | 3.31 ms | 300 µs | 24,086 |
| realistic | ext_proc | 4.33 ms | 5.97 ms | 1,135 µs | 10,814 |
| realistic | sync | 4.98 ms | 8.66 ms | 596 µs | 7,733 |
| realistic | async | 3.60 ms | 4.99 ms | 791 µs | 11,572 |
| +1 ms I/O | ext_proc | 5.21 ms | 6.91 ms | 1,143 µs | 10,589 |
| +1 ms I/O | sync | 16.79 ms | 24.85 ms | 620 µs | 1,833 |
| +1 ms I/O | async | 3.97 ms | 5.25 ms | 789 µs | 11,263 |
Latency and CPU at 2,000 requests/s; max rps at saturation with 64 connections. Envoy with no filter: 1.90 ms p50, 195 µs CPU, 28,810 rps.
What the numbers say:
- ext_proc’s transport costs about 1 ms and twice the CPU, even over a local unix socket. No network is involved, so this is gRPC and protobuf work: serializing headers and crossing the socket costs as much as the filters themselves.
- Async wins on every chain: 0.7 to 1.2 ms lower median latency than ext_proc and about 30% less CPU. At saturation it served about 52% more requests per CPU core.
- Sync is a trap. It uses the least CPU, but the chain competes with proxying on Envoy’s four workers. The realistic chain topped out at 7,733 rps against ext_proc’s 10,814. With one 1 ms blocking call, it fell to 1,833 rps and a 16.8 ms median.
Gotchas Link to heading
- The module is locked to an exact Envoy build. Istio’s bundled Envoy uses an older module ABI than upstream Envoy 1.40, so every Istio upgrade means rebuilding the module. The istio-proxy binary reports the istio/proxy commit; the Envoy commit you need is in that repository’s
WORKSPACEfile. GODEBUG=cgocheck=0is mandatory. Without it, Envoy aborts while loading the first filter config, and upstream has no plan to change that.- A panic takes down the gateway, not a sidecar. Older SDKs have no panic recovery at all. Even with it, Go fatal errors (a concurrent map write, running out of memory) kill every connection on the pod. Wrap the chain in
recover(). - Resources move into Envoy’s container. CPU and Go heap now count against its limits, and the Go heap is invisible to Envoy’s overload manager. Set
GOMEMLIMIT. - The library is big. Ours was 81 MiB (32 MiB gzipped);
-ldflags="-s -w"strips about 21 MiB of that. - Fewer safety nets. There is no
failure_mode_allow. A module fetched from a remote URL fails open: if the download fails, the filter isn’t installed at all. Ship the library in the image.
Where this leaves us Link to heading
The filters move over unchanged, and async in-process is faster and cheaper. Whether we adopt it won’t be decided by the benchmark, though. It depends on how our routing use cases evolve: if setting headers before the routing decision and choosing destinations in-process become central, the trade-offs above are worth paying. Until then, ext_proc stays.