L4 vs L7 Load Balancing
Design a small subsystem that relies on L4 vs L7 Load Balancing. Outline components, data flow, failure modes, and metrics.
Answers use simple, clear English.
Quick interview answer
Use L4 vs L7 Load Balancing as the core idea. Example shape: ALB routes /api → API target group, /static → S3; NLB for gRPC TCP passthrough..
Detailed answer
Use L4 vs L7 Load Balancing as the core idea. Example shape: ALB routes /api → API target group, /static → S3; NLB for gRPC TCP passthrough.. Watch for: L7 terminates TLS — cert management; L4 no URL awareness.. Measure success via latency/error/saturation. Core: L4 (TCP) routes by IP/port fast. L7 (HTTP) routes by path/header/cookie — enables sticky sessions, TLS, WAF integration. Real-time example: ALB routes /api → API target group, /static → S3; NLB for gRPC TCP passthrough. Pros: L7 smart routing; L4 performance for non-HTTP. Cons: L7 terminates TLS — cert management; L4 no URL awareness. Common mistakes: L7 LB without health checks; single LB bottleneck. Best practices: Health check app endpoint not TCP only; cross-zone LB. Audience level: Senior.
Full explanation
L4 (TCP) routes by IP/port fast. L7 (HTTP) routes by path/header/cookie — enables sticky sessions, TLS, WAF integration.
Real example & use case
ALB routes /api → API target group, /static → S3; NLB for gRPC TCP passthrough.
Pros & cons
Pros: L7 smart routing; L4 performance for non-HTTP. Cons: L7 terminates TLS — cert management; L4 no URL awareness.
Common mistakes
L7 LB without health checks; single LB bottleneck.
Best practices
Health check app endpoint not TCP only; cross-zone LB.
Follow-up questions
Open one as its own read / solve / listen card