HAProxy vs nginx

LB choice.

Overview

HAProxy and nginx are the two dominant open-source load balancers and they overlap heavily on HTTP. The differences land at the edges: HAProxy is purpose-built as an LB (superior TCP load balancing, fine-grained traffic management), nginx is a web server that also load-balances (mature HTTP/2 and HTTP/3, static-file serving, reverse-proxy plus LB in one). Both scale to massive traffic.

The approach

HAProxy for TCP load balancing, nginx for HTTP plus origin or static serving, either for HTTP-only LB (pick the one the team already knows). Use cloud LB (ALB, Cloud Load Balancing) where possible to avoid self-hosting either; document the rationale per tier so the choice is defensible.

Why this compounds

The right LB choice compounds across years. Traffic-management patterns and team expertise align with the tool; cross-tier tooling (health checks, observability, deploy automation) gets reused. Switching cost grows year over year, so getting the choice right at design time pays back indefinitely.