Microservice Patterns
API Gateway:
Entry point for microservices with cross-cutting concerns.
Handles security, rate limiting, and load balancing.
Utilizes tools like Spring Cloud Zuul or Spring Cloud Gateway.
Service Discovery:
Allows services to find each other by name.
Manages dynamic IP changes caused by container spin-ups.
Implemented with Spring Cloud Eureka or Kubernetes service.
Circuit Breaker:
Prevents service failures by handling transient errors.
Offers fallback mechanisms or caches results.
Implemented using libraries like Hystrix or Resilient4J.
Bulkhead:
Divides thread pools to isolate resources.
Prevents service failures from impacting others.
Implemented with Resilient4J for fault tolerance.
CQRS (Command Query Responsibility Segregation):
Separates write and read operations for scalability.
Optimizes database tables differently.
Event Driven Pattern:
Enables communication between services without coupling.
Uses event-driven messaging queues like RabbitMQ or Apache Kafka.
Saga:
Manages distributed transactions scalably.
Offers Orchestration and Choreography options.
Strangler Pattern:
Decomposes monolithic apps into microservices gradually.
Extracts features into separate microservices.
Sidecar:
Attaches cross-cutting concern services alongside business services.
Deploys sidecar services in the same pod for seamless communication.
Utilizes tools like Envoy proxy.
BFF (Backend for Frontend):
Customizes microservices for different platforms.
Optimizes performance based on platform requirements.
Ensures redundancy while avoiding resource waste.