deployment and operations
Health Checks
Health checks tell infrastructure whether an application instance can receive traffic. Keep liveness and readiness concerns deliberate and avoid expensive checks that overload dependencies.
Separate Liveness From Readiness
- Expose a lightweight app endpoint.
- Use readiness for required dependencies where platform routing needs it.
- Keep liveness focused enough to avoid restart loops.
Simulate Failure
- Check healthy app.
- Simulate dependency failure.
- Verify routing or alert response.
Keep Probes Cheap
- Always-200 checks hide broken dependencies.
- Deep checks on every probe overload systems.
- Restart loops can worsen outages.
Endpoint Split
GET /health/live -> process can answer
GET /health/ready -> instance can receive application traffic
Health checks are ready when their failure meaning and platform response are understood. A probe is part of production control flow: a badly designed check can hide an outage or cause restart loops that worsen one.
Practice
Practice: Design App Health Checks
Design lightweight liveness and readiness endpoints for a PHP web app, then describe how each behaves during a database outage.
Requirements
- Expose a lightweight app endpoint.
- Use readiness for required dependencies where platform routing needs it.
- Keep liveness focused enough to avoid restart loops.
- Check healthy app.
- Simulate dependency failure.
- Verify routing or alert response.
Show solution
Use liveness to show that the process can answer. Use readiness to indicate whether the instance should receive application traffic, including only required dependency checks that the platform needs.
Simulate a database failure in staging and verify the readiness response plus routing or alert behaviour. Keep probes cheap enough that frequent checks do not overload the dependencies they are observing.