<strong>Health checks</strong> are automated tests that constantly verify if a server or service is working properly. If a health check fails, the system can take action.
The Doctor's Checkup
Like a doctor checking your pulse and temperature, health checks verify servers are alive and working.
Health Check
Regular examination
Healthy
All systems go
Unhealthy
Take action
Automated check
Responds with status
Keep routing traffic
Define Health Endpoint
Create /health route that checks critical functions
Schedule Checks
Ping the endpoint every 10-60 seconds
Server Responds
Returns 200 OK if healthy, 500 if problems
Detect Failure
If 3 checks fail in a row, mark as unhealthy
Take Action
Stop sending traffic, alert team, restart server
Wrong
Health checks just ping the server to see if it's on
Correct
Good health checks test critical functions: Can it connect to the database? Is memory usage normal? Can it process requests? A server can be 'on' but still unhealthy.
AWS Load Balancer health checks:
Checks /health every 30 seconds
Healthy response: 200 OK + 'database connected'
Unhealthy: Server doesn't respond or returns 500
After 3 failed checks, stop sending traffic to that server
Automatically routes users to healthy servers only