What Envoy Does
- L7 proxy — HTTP/1.1, HTTP/2, HTTP/3, gRPC
- L4 proxy — TCP, UDP, TLS
- Load balancing — round robin, least request, ring hash, maglev
- Service discovery — DNS, EDS (Endpoint Discovery Service)
- Health checking — active and passive
- Circuit breaking — per-upstream limits
- Rate limiting — local and global
- Observability — stats (Prometheus), tracing (Jaeger/Zipkin), access logs
- TLS — termination and origination, mTLS
- xDS API — dynamic configuration via control plane
- WASM filters — extend Envoy with WebAssembly
Architecture
Single-process, multi-threaded C++ binary. Listeners accept connections, filter chains process them, clusters route to upstreams. xDS APIs (LDS, RDS, CDS, EDS, SDS) allow dynamic configuration from a control plane (like Istio or custom gRPC services). Hot restart enables zero-downtime upgrades.
Self-Hosting
# docker-compose.yml
version: "3"
services:
envoy:
image: envoyproxy/envoy:v1.31-latest
ports:
- "10000:10000"
- "9901:9901"
volumes:
- ./envoy.yaml:/etc/envoy/envoy.yamlKey Features
- L4/L7 proxying
- HTTP/2 and gRPC native
- Dynamic configuration (xDS)
- Service discovery
- Circuit breaking and rate limiting
- Observability (stats, tracing, logging)
- mTLS
- WASM filter extensibility
- Hot restart
- Admin API
Comparison
| Proxy | Type | Config | Language |
|---|---|---|---|
| Envoy | L4/L7 | xDS API | C++ |
| Nginx | L4/L7 | Static files | C |
| HAProxy | L4/L7 | Static files | C |
| Traefik | L7 | Auto-discovery | Go |
| Caddy | L7 | Caddyfile/API | Go |
| Linkerd2-proxy | L4/L7 (sidecar) | Control plane | Rust |
常见问题 FAQ
Q: Envoy vs Nginx? A: Nginx 擅长静态文件 + 简单反代(配置简单);Envoy 擅长微服务场景(动态配置、gRPC、可观测性、service mesh)。很多项目 Nginx 做入口,Envoy 做服务间代理。
Q: 和 Istio 关系? A: Istio 是控制面,Envoy 是数据面。Istio 通过 xDS API 给每个 Pod 的 Envoy sidecar 下发路由规则、mTLS 证书。
Q: WASM 扩展? A: 用 Rust/C++/Go/TinyGo 编写 WASM filter 扩展 Envoy 功能(自定义 header 修改、鉴权、限流逻辑),不需要重编译 Envoy。
来源与致谢 Sources
- Docs: https://www.envoyproxy.io/docs
- GitHub: https://github.com/envoyproxy/envoy
- License: Apache 2.0