1. What is the API Gateway Pattern?
Answer:
The API Gateway Pattern involves using a single entry point to manage and route client requests to appropriate microservices. It handles cross-cutting concerns such as authentication, logging, rate limiting, and response transformation.
Benefits:
- Simplifies client-side code by providing a unified interface.
- Centralizes authentication and authorization.
- Enables load balancing and caching strategies.
Use Case:
Ideal for systems where clients need to interact with multiple microservices, such as mobile or web applications accessing various backend services.
2. What is the Database per Service Pattern?
Answer:
In the Database per Service Pattern, each microservice has its own dedicated database. This ensures loose coupling between services and allows them to be developed, deployed, and scaled independently.
Benefits:
- Promotes service autonomy and encapsulation.
- Facilitates independent scaling and deployment.
- Reduces the risk of cascading failures due to shared databases.
Use Case:
Suitable for microservices architectures where services manage distinct data domains, ensuring data ownership and integrity.
3. What is the Circuit Breaker Pattern?
Answer:
The Circuit Breaker Pattern is used to detect failures and encapsulate the logic of preventing a failure from constantly recurring during maintenance, temporary external system failure, or unexpected system difficulties. It acts like an electrical circuit breaker, stopping the flow of requests to a failing service and allowing it to recover.
Benefits:
- Prevents cascading failures across services.
- Improves system resilience and stability.
- Allows fallback mechanisms to maintain functionality.
Use Case:
Applicable when integrating with external services that may be unreliable or have high latency, ensuring that failures in one service do not impact the entire system.
4. What is the Retry Pattern?
Answer:
The Retry Pattern involves automatically retrying a failed operation, often with a delay between attempts, to handle transient faults. This pattern is useful when failures are temporary and may succeed if retried after some time.
Benefits:
- Enhances fault tolerance by handling transient issues.
- Improves user experience by reducing failure rates.
- Can be combined with exponential backoff strategies.
👉The Next Questions-2: MICROSERVICE PATTERNS