Serksa
All Concepts
DevOps & Infrastructure

Health Checks

1

What is it?

<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.

2

Think of it like...

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

3

Visual Flow

Every 30s

Automated check

🖥️Server

Responds with status

Healthy

Keep routing traffic

4

Where you see it

1

Define Health Endpoint

Create /health route that checks critical functions

2

Schedule Checks

Ping the endpoint every 10-60 seconds

3

Server Responds

Returns 200 OK if healthy, 500 if problems

4

Detect Failure

If 3 checks fail in a row, mark as unhealthy

5

Take Action

Stop sending traffic, alert team, restart server

5

Common Mistake

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.

💡 Real-World Example

AWS Load Balancer health checks:

1

Checks /health every 30 seconds

2

Healthy response: 200 OK + 'database connected'

3

Unhealthy: Server doesn't respond or returns 500

4

After 3 failed checks, stop sending traffic to that server

5

Automatically routes users to healthy servers only