Bird
0
0

Which approach best follows the health check pattern?

hard📝 Trade-off Q15 of 15
Microservices - Resilience Patterns
You design a microservice system with multiple services. To improve reliability, you want to implement health checks that also verify database and cache connectivity. Which approach best follows the health check pattern?
AEach service exposes a <code>/health</code> endpoint that always returns 200 regardless of dependency status
BOnly one central service exposes a health check endpoint for all services combined
CEach service exposes a <code>/health</code> endpoint that returns 200 only if all dependencies (database, cache) are reachable; otherwise returns 503
DHealth checks are done by querying the database directly without service endpoints
Step-by-Step Solution
Solution:
  1. Step 1: Understand health check pattern for dependencies

    Health checks should verify the service and its critical dependencies like database and cache to ensure full functionality.
  2. Step 2: Evaluate the options for best practice

    Each service exposes a /health endpoint that returns 200 only if all dependencies (database, cache) are reachable; otherwise returns 503 correctly implements a health endpoint that returns 200 only if all dependencies are healthy, otherwise 503. This supports automatic recovery and monitoring.
  3. Final Answer:

    Each service exposes a /health endpoint that returns 200 only if all dependencies (database, cache) are reachable; otherwise returns 503 -> Option C
  4. Quick Check:

    Health check includes dependencies, returns 200 or 503 [OK]
Quick Trick: Health check must verify all critical dependencies [OK]
Common Mistakes:
MISTAKES
  • Ignoring dependency status in health check
  • Relying on a single central health endpoint
  • Checking dependencies outside service endpoints

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Microservices Quizzes