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.
| Object | Purpose | Example |
|---|---|---|
| Listener | Accepts downstream connections | Port 443 on all interfaces |
| Filter chain | Ordered processing steps | TLS, HTTP manager, router |
| Route | Matches requests to clusters | Path /api goes to api-cluster |
| Cluster | Group of upstream hosts | Three instances of a payment service |
| Endpoint | One upstream address | 10.0.4.12:8080 |
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.
| Policy | How it selects a host | Best fit |
|---|---|---|
| Round robin | Cycles through healthy hosts, optionally weighted | Similar hosts, uniform requests |
| Least request | Picks the less loaded of random candidates | Variable request cost |
| Ring hash | Consistent hashing on a request key | Session or cache affinity |
| Maglev | Fixed lookup table from consistent hashing | Affinity with faster rebuilds |
| Random | Uniform random choice | Very large host sets |
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.
| API | Full name | What it delivers |
|---|---|---|
| LDS | Listener discovery service | Listeners and filter chains |
| RDS | Route discovery service | HTTP route tables |
| CDS | Cluster discovery service | Upstream cluster definitions |
| EDS | Endpoint discovery service | Current host addresses and weights |
| SDS | Secret discovery service | TLS certificates and keys |
| ADS | Aggregated discovery service | All resources over one ordered stream |
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.
| Tool | Configuration model | Typical role |
|---|---|---|
| Envoy Proxy | Dynamic xDS APIs, YAML bootstrap | Sidecar, gateway, mesh data plane |
| HAProxy | Configuration file, runtime API | High-throughput edge and internal balancing |
| NGINX | Configuration file with reloads | Web server, reverse proxy, edge |
| F5 BIG-IP | Appliance with management GUI and API | Enterprise data center edge |
| Keepalived | VRRP and IPVS configuration | Layer 4 balancing and virtual IP failover |
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.
| Symptom | Likely cause | Fix |
|---|---|---|
| Requests rejected with 503 under load | Default circuit breaker limits reached | Raise thresholds per cluster |
| Long-lived streams cut off | Default route timeout of 15 seconds | Set stream or route timeouts explicitly |
| Uneven load on gRPC backends | Layer 4 balancing in front of Envoy | Let Envoy balance per request |
| Configuration not applied | Rejected xDS update | Check control plane NACK messages |
| High sidecar memory use | Full mesh configuration pushed to every proxy | Scope resources per workload |
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.