Shallow vs Deep Health Checks
What you'll learn: How to balance thoroughness with efficiency when verifying your services are truly healthy.
The Core Distinction
When a load balancer checks if a backend server is healthy, it can perform either a shallow check or a deep check.
A shallow health check (sometimes called a "liveness check") verifies only basic availability—typically just checking if the service responds to a simple ping or returns a 200 OK status. It's like knocking on someone's door and hearing "I'm here!"
A deep health check (or "readiness check") goes further by testing critical dependencies: Can the service reach its database? Is the cache accessible? Are downstream APIs responding? It's like asking "Are you here AND ready to actually do your job?"
The Trade-off
Shallow checks are fast, lightweight, and won't overload your infrastructure. They run frequently (every few seconds) without causing strain. However, they might mark a server as healthy even when it can't actually serve requests—imagine a web server that's running but can't reach its database.
Deep checks provide more confidence that the service can handle real traffic, but they:
- Take longer to execute
- Consume resources (database connections, API calls)
- Can create cascading load on downstream systems
- May trigger false failures if dependencies are temporarily slow
Finding Balance
Most production systems use shallow checks frequently (every 2-5 seconds) for rapid failure detection, and optionally run deep checks less frequently (every 30-60 seconds) or on-demand during deployment verification.
Key Takeaway: Shallow health checks provide fast failure detection with minimal overhead, while deep checks verify actual readiness but must be used sparingly to avoid straining your system's dependencies.