Design Pattern vs Anti Pattern in Microservices

Design Pattern

Microservices design patterns are software design patterns that generates reusable autonomous services. The goal for developers using microservices is to accelerate application releases. By using microservices, developers can deploy each individual microservice independently, if desired.

Uses of a Design pattern are: -

Design patterns, in particular, are used to find solutions to design issues.

  • To help you discover the less obvious, look for appropriate objects and the things that capture these abstractions.

  • Choose an appropriate granularity for your object — patterns can assist with the compositional process.

  • Define object interfaces — this will aid in the hardening of your interfaces and a list of what’s included and what isn’t

  • Help you comprehend by describing object implementations and the ramifications of various approaches.

  • Eliminating the need to consider what strategy is most successful by promoting reusability.

  • Provide support for extensibility, which is built-in modification and adaptability.

Problem with Design Pattern

Because of this, patterns aren’t the cure-all for good: —

  • Over-engineering

  • Time-consuming and inconvenient

  • Intricate to keep up with

Different Design Pattern in Microservices

1. Aggregator Microservice Design Pattern: The first, and probably the most common, is the aggregator microservice design pattern. In its simplest form, Aggregator would be a simple web page that invokes multiple services to achieve the functionality required by the application.

2. Proxy Microservice Design Pattern: Proxy microservice design pattern is a variation of Aggregator. In this case, no aggregation needs to happen on the client but a different microservice may be invoked based upon the business need. Just like Aggregator, Proxy can scale independently on X-axis and Z-axis as well. You may like to do this where each individual service need not be exposed to the consumer and should instead go through an interface.

3. Chained Microservice Design Pattern: Chained microservice design pattern produce a single consolidated response to the request. In this case, the request from the client is received by Service A, which is then communicating with Service B, which in turn may be c