| Users | Requests per Second (RPS) | Health Check Complexity | Infrastructure Impact |
|---|---|---|---|
| 100 users | ~10-50 RPS | Simple / Basic (e.g., HTTP 200) | Minimal load, single server handles checks |
| 10,000 users | ~1,000-5,000 RPS | Include dependency checks (DB, cache) | Load balancer health checks start impacting servers |
| 1,000,000 users | ~100,000 RPS | Lightweight checks, caching results | Dedicated health check service or endpoint rate limiting needed |
| 100,000,000 users | ~10,000,000+ RPS | Aggregated health status, asynchronous checks | Distributed health monitoring system, offload checks from main servers |
Health check endpoints in HLD - Scalability & System Analysis
The first bottleneck is the application servers' CPU and network resources. Health check endpoints, if not optimized, generate frequent requests that consume CPU cycles and network bandwidth. At medium scale (~10,000 users), the load balancer's frequent health checks can overwhelm servers if checks are heavy (e.g., checking multiple dependencies synchronously).
- Lightweight Checks: Keep health checks simple and fast, returning cached or precomputed status.
- Rate Limiting: Limit frequency of health check requests to reduce load.
- Dedicated Health Check Service: Offload health checks to separate service or sidecar to avoid impacting main app.
- Asynchronous Checks: Perform dependency checks asynchronously and cache results for quick responses.
- Load Balancer Configuration: Adjust health check intervals and timeouts to balance freshness and load.
- Distributed Monitoring: Use external monitoring tools to reduce internal health check traffic.
Assuming 10,000 users generating ~5,000 health check requests per second:
- Each health check response ~1 KB -> 5,000 KB/s (~5 MB/s) bandwidth per server.
- CPU usage: lightweight checks consume ~1-5% CPU per 1,000 RPS; at 5,000 RPS, ~5-25% CPU.
- Memory: minimal, mostly for caching health status (~few MBs).
- Scaling servers horizontally reduces per-server load.
When discussing health check endpoint scalability, start by explaining the purpose of health checks. Then describe how load increases with users and how naive implementations can overload servers. Discuss bottlenecks clearly, then propose practical solutions like caching, rate limiting, and dedicated services. Use real numbers to show understanding of impact.
Your database handles 1000 QPS. Traffic grows 10x. What do you do first?
Answer: Since the database is the bottleneck, first add read replicas and implement caching to reduce direct database queries. Also, optimize queries and consider rate limiting health check frequency to reduce load.
Practice
Solution
Step 1: Understand the role of health check endpoints
Health check endpoints are designed to tell if a service is alive and working properly.Step 2: Identify the correct purpose among options
Only To verify if the service is alive and functioning describes checking the service's health, while others describe unrelated functions.Final Answer:
To verify if the service is alive and functioning -> Option AQuick Check:
Health check = Verify service alive [OK]
- Confusing health check with authentication
- Thinking health check stores data
- Assuming health check serves website content
Solution
Step 1: Recall standard health check paths
Readiness endpoints typically use the path/readyto indicate if the service is ready to accept traffic.Step 2: Match the correct path
Among the options, only/readyis the standard path for readiness checks.Final Answer:
/ready -> Option AQuick Check:
Readiness path = /ready [OK]
- Using /health for readiness instead of liveness
- Confusing /status or /check as standard paths
- Mixing readiness and liveness endpoints
if database.isConnected() and cache.isAvailable():
return 200
else:
return 503What HTTP status code will the endpoint return if the database is connected but the cache is down?
Solution
Step 1: Analyze the condition logic
The endpoint returns 200 only if both database.isConnected() and cache.isAvailable() are true.Step 2: Evaluate the given scenario
Database is connected (true), cache is down (false), so condition fails and returns 503.Final Answer:
503 -> Option BQuick Check:
Both must be true for 200; else 503 [OK]
- Assuming 200 if only one service is healthy
- Confusing 503 with 404 or 500
- Ignoring the AND condition in the code
def health_check():
if db.connected() or cache.available():
return 200
else:
return 503What is the main problem with this health check logic?
Solution
Step 1: Understand the logical operator used
The code uses OR, so it returns 200 if either db.connected() or cache.available() is true.Step 2: Identify the issue with health check accuracy
This means it reports healthy even if one service is down, which can mislead monitoring systems.Final Answer:
It returns 200 even if only one service is healthy -> Option CQuick Check:
OR allows partial health, which is incorrect [OK]
- Using OR instead of AND in health checks
- Ignoring partial failures in health status
- Misinterpreting HTTP status codes
/health endpoint for liveness and a /ready endpoint for readiness. Which of the following best describes when the /ready endpoint should return HTTP 503?Solution
Step 1: Understand readiness vs liveness
Liveness (/health) checks if service is alive; readiness (/ready) checks if it can handle requests safely.Step 2: Identify readiness failure condition
Readiness returns 503 if dependencies (like database) are missing, so service should not receive traffic yet.Final Answer:
When the service is alive but not ready to accept traffic due to missing dependencies -> Option DQuick Check:
Readiness 503 = alive but not ready [OK]
- Confusing liveness failure with readiness failure
- Returning 503 when service is fully down (should be liveness)
- Assuming overload means readiness failure
Ready to prove it?
Pass the test and this pattern moves unknown
