Microservices design patterns are proven solutions to recurring problems in distributed systems, covering areas like routing, resilience, and service location.
Key Points: • The API Gateway pattern provides a single entry point that routes client requests to the appropriate backend services, centralizing cross-cutting concerns like auth and rate limiting. • The Circuit Breaker pattern stops repeated calls to a failing service and routes them to a fallback, preventing cascading failures. • The Service Discovery pattern lets services locate each other dynamically through a registry (like Eureka or Consul) instead of hard-coded addresses. • The Saga pattern manages distributed transactions across services using a sequence of local transactions with compensating actions on failure. • The Strangler pattern incrementally migrates a monolith to microservices by routing traffic to new services while the old system is gradually decommissioned.
Example: A team migrating an e-commerce monolith might use the Strangler pattern to peel off the "Product Catalog" as its first microservice, an API Gateway to route catalog requests to it, and Service Discovery so the gateway can find catalog instances as they scale.
Interview Tip: A concise interview answer is:
"I'm familiar with the API Gateway pattern for a single entry point, Circuit Breaker for fault isolation, Service Discovery so services can find each other dynamically, the Saga pattern for distributed transactions, and the Strangler pattern for incrementally migrating a monolith. Each solves a specific recurring problem in distributed systems."