133 Reverse Proxy and Load Balancing
133 Reverse Proxy and Load Balancing
A reverse proxy is a reliability boundary: it enforces routing policy, mediates failures, and protects backend services.
Request Path
client -> edge proxy -> route match -> upstream selection -> backend
-> policy layer (auth, limits, timeout)
Routing Model
Keep routing deterministic and debuggable:
- Exact routes first.
- Prefix/wildcard routes second.
- Explicit default/fallback behavior.
Upstream Selection
Round-robin is a baseline, but production systems also need health awareness:
- Remove failing nodes quickly.
- Reintroduce nodes only after recovery checks.
- Prevent hot-spotting during partial outages.
Timeout and Retry Boundaries
Proxy retries can multiply load if misconfigured. Always apply:
- Attempt limits.
- Retryable method/status rules.
- Total request budget cap.
Why This Chapter Matters
Most distributed outages are coordination failures across otherwise healthy components. A well-designed proxy reduces blast radius by making policies explicit and centrally observable.