How do health checks work on a load balancer and what makes a good one?
BeginnerScenarioLoad Balancing, Proxies & CDN
Answer
Situation read → A health check decides which targets receive traffic.
What I'd do →
- The LB probes each target periodically, for example HTTP GET
/healthzevery 10 seconds - A target is marked unhealthy after N consecutive failures and healthy after M successes
- Keep the endpoint cheap and check only what this instance needs (can it serve?), not every downstream
- Configure in AWS with
aws elbv2 modify-target-group --health-check-path /healthz --healthy-threshold-count 2 - Return 200 only after the app is warmed up
Why → Deep health checks that fail when the database is down can take the entire fleet out at once.
Interview tip → Say you separate liveness from readiness in Kubernetes for the same reason.
More on Load Balancing, Proxies & CDN
What is the difference between a Layer 4 and a Layer 7 load balancer?BeginnerWhen do you choose an ALB and when an NLB in AWS?BeginnerForward proxy versus reverse proxy: what is the difference?BeginnerWhat are sticky sessions and why would you avoid them?BeginnerWhat does a CDN do and when does it help?BeginnerYour app sees the load balancer's IP instead of the real client IP. How do you get the real one?Beginner