Skip to content

Metadata Card

  • Prerequisites: Chapter 13 (Monolith to Microservices Migration)
  • Estimated Time: 45 minutes
  • Core Difficulty: Intermediate
  • Completion Milestone: Understand service governance patterns and their applications

Your Progress

You split into three machines: Player Engine, Match Engine, Score Engine. They communicate via magic pipes.

But the Score Engine was moved to a new workshop — coordinates changed. The Player Engine's pipe blueprints had hardcoded coordinates — all score queries failed. You manually updated the blueprints and restarted. The next day, another workshop deployed its own Score Engine on a different workbench. Your Task

Microservices aren't just about splitting code. They're about "how to find each other," "how to route requests," "how to survive failures," and "how to distribute configuration."


First Layer: Service Discovery

A "phone book" — services register their address on startup, others query to find them.

Client-side discovery: Client queries registry → gets instance list. Server-side discovery: Client queries a load balancer (K8s Service).

Second Layer: API Gateway

A unified entry point. Routes: /api/players/* → player-service, /api/matches/* → match-service. Also handles auth, rate limiting, request logging.

Third Layer: BFF (Backend For Frontend)

Dedicated backends for each client type — Web BFF, Mobile App BFF, Third-party Gateway.

Fourth Layer: Circuit Breaker

Monitor remote call failure rate. When threshold exceeded, open the circuit — return failure immediately without making the real call. After a timeout, half-open to probe.

Fifth Layer: Retry & Timeout

Not all failures need circuit breaking. Network jitter — a single retry might succeed. Use exponential backoff. Only retry on idempotent operations.


Common Pitfalls

API Gateway becomes single bottleneck — deploy multiple replicas. Configuration conflicts between circuit breaker, retry, and timeout. Authentication logic repeated across services. Service discovery update latency.


Traveler's Notes

Service discovery lets services find each other, API Gateway unifies entry, Circuit Breaker prevents cascading failures, retry/timeout distinguishes transient from permanent failures. These basics make multiple services work together.


Next: Data Consistency Patterns (Chapter 15).

Built with VitePress | Software Systems Atlas