Envoy Proxy

Also known as: Envoy

On this page 8

Envoy Proxy is an open-source, high-performance Layer 4 and Layer 7 proxy written in C++ that routes, balances and observes network traffic between clients and services. In load balancing, Envoy acts as a programmable data plane: it distributes requests across upstream hosts with configurable algorithms, health checks and resilience policies, and it receives most of its configuration dynamically from a control plane.

Commonly shortened to Envoy, the proxy was created at Lyft, released as open source in 2016 and later graduated within the Cloud Native Computing Foundation. It runs as an edge gateway, a service mesh sidecar or a standalone internal load balancer.

How Envoy Proxy processes a connection

Envoy handles traffic through listeners, filter chains and clusters. A listener binds to an address and port, a filter chain inspects and transforms the connection or request, and a cluster is a named group of upstream endpoints to which traffic is finally forwarded.

Processing happens in layers. Listener filters run first, for example to detect TLS or read the PROXY protocol header. Network filters then handle raw bytes, such as TCP proxying or rate limiting. For HTTP, the HTTP connection manager decodes HTTP/1.1, HTTP/2 or HTTP/3 and passes each request through HTTP filters for authentication, header manipulation and routing.

Envoy uses a multi-threaded, non-blocking event model. A main thread manages configuration and statistics, while each worker thread owns its connections from accept to close, so most request processing needs no locking between threads.

The table below lists the core objects that appear in almost every Envoy configuration.

ObjectPurposeExample
ListenerAccepts downstream connectionsPort 443 on all interfaces
Filter chainOrdered processing stepsTLS, HTTP manager, router
RouteMatches requests to clustersPath /api goes to api-cluster
ClusterGroup of upstream hostsThree instances of a payment service
EndpointOne upstream address10.0.4.12:8080
Core Envoy configuration objects

Load balancing policies in Envoy

Envoy selects an upstream host per request or per connection using a cluster-level load balancing policy. Because it terminates HTTP/2 and gRPC, Envoy can balance individual requests over long-lived connections, which a pure Layer 4 balancer cannot do.

The following table compares the built-in policies and the situations in which each fits.

PolicyHow it selects a hostBest fit
Round robinCycles through healthy hosts, optionally weightedSimilar hosts, uniform requests
Least requestPicks the less loaded of random candidatesVariable request cost
Ring hashConsistent hashing on a request keySession or cache affinity
MaglevFixed lookup table from consistent hashingAffinity with faster rebuilds
RandomUniform random choiceVery large host sets
Envoy load balancing policies

The default least request policy applies the power of two choices technique: it samples two hosts and sends the request to the one with fewer active requests. This approach avoids the herd behavior of a strict global minimum. Envoy also supports zone-aware routing and priority levels, which keep traffic local and fail over to other localities only when healthy capacity drops.

Dynamic configuration through xDS

Envoy can be configured statically, but production deployments usually rely on the xDS discovery APIs, a family of gRPC or REST services through which a control plane pushes configuration without restarting the proxy. This separation of control plane and data plane is the main reason Envoy became the standard sidecar for service meshes.

APIFull nameWhat it delivers
LDSListener discovery serviceListeners and filter chains
RDSRoute discovery serviceHTTP route tables
CDSCluster discovery serviceUpstream cluster definitions
EDSEndpoint discovery serviceCurrent host addresses and weights
SDSSecret discovery serviceTLS certificates and keys
ADSAggregated discovery serviceAll resources over one ordered stream
Main xDS discovery services

Control planes such as Istio, Envoy Gateway or a custom implementation translate high-level intent, for example a Kubernetes Gateway API route, into xDS resources. Envoy also supports hot restart for binary upgrades with minimal connection loss.

Resilience and observability features

Envoy adds resilience controls at the proxy layer, so applications do not need to implement them in each language. Active health checks probe hosts over HTTP, TCP or gRPC, while outlier detection passively ejects hosts that return consecutive errors. Circuit breakers cap connections, pending requests and retries per cluster, and retry budgets with timeouts prevent retry storms.

For observability, Envoy emits detailed statistics for every listener, cluster and route, structured access logs and distributed tracing spans. Operators inspect live state through the admin interface, which should never be exposed to untrusted networks.

Envoy compared with other load balancers

Envoy differs from traditional load balancers mainly in its API-driven configuration and its focus on service-to-service traffic. The table below contrasts it with tools from the same Topic.

ToolConfiguration modelTypical role
Envoy ProxyDynamic xDS APIs, YAML bootstrapSidecar, gateway, mesh data plane
HAProxyConfiguration file, runtime APIHigh-throughput edge and internal balancing
NGINXConfiguration file with reloadsWeb server, reverse proxy, edge
F5 BIG-IPAppliance with management GUI and APIEnterprise data center edge
KeepalivedVRRP and IPVS configurationLayer 4 balancing and virtual IP failover
Envoy and related load balancers

In raw throughput, a well-tuned HAProxy or NGINX is often comparable to Envoy, so performance alone rarely decides the choice. Envoy wins when configuration changes constantly, when gRPC and HTTP/2 dominate, or when a service mesh requires uniform behavior across many services.

Limitations and common mistakes

Envoy is powerful but verbose and complex to configure by hand, and most problems come from misunderstanding its defaults. The table below lists frequent symptoms with their causes and fixes.

SymptomLikely causeFix
Requests rejected with 503 under loadDefault circuit breaker limits reachedRaise thresholds per cluster
Long-lived streams cut offDefault route timeout of 15 secondsSet stream or route timeouts explicitly
Uneven load on gRPC backendsLayer 4 balancing in front of EnvoyLet Envoy balance per request
Configuration not appliedRejected xDS updateCheck control plane NACK messages
High sidecar memory useFull mesh configuration pushed to every proxyScope resources per workload
Common Envoy problems

In everyday language

Envoy is like a smart receptionist at a large office. Visitors arrive at one front desk, and the receptionist decides which available employee should help each one, avoiding anyone who is busy or absent.

The receptionist also keeps a log of every visit and follows instructions that a manager can update at any moment without closing the office. The key point is flexible, constantly updated routing: traffic always goes to a healthy destination, and the rules change without interrupting service.

Seen in the real world

An online retailer runs about 40 microservices on Kubernetes and uses Envoy as an edge gateway plus sidecars managed by a service mesh. Checkout traffic is gRPC over HTTP/2, which previously concentrated on a few pods because a Layer 4 balancer pinned each long-lived connection to one backend.

After the move, Envoy balances each gRPC request with the least request policy and ejects pods that return five consecutive errors through outlier detection. During a holiday sale, one payment pod degrades because of a slow database replica; Envoy removes it from rotation within seconds.

The result is that checkout latency stays stable while the team investigates, and pod CPU utilization varies by less than 10 percent across replicas instead of the previous wide imbalance.