Microservice based architecture

Microservices or Micro service-based architecture is a term popularized in the early 2010s, defining an application as a collection of small autonomous services, modeled around a business domain. It is a way to break up big monolith applications into small tiny micro applications which are packaged and deployed independently. Monolith applications have its benefits, especially in the early stages, such as: simple to develop, making radical changes, straightforward testing and deploying. But, over the time scaling monolith application proves to be difficult. In that case, using a microservice pattern to decompose monolith might be an answer.

 

There are several benefits to developing in microservice pattern:

  • Services are relatively small and can be developed by small teams (as Amazon put it “two pizza teams”)
  • Each team becomes an expert in a particular domain and an expert in the technologies that are best suited for those particular services
  • Each service can have its own tech stack, that is best suited for its task (because of this, one of the proposed names for microservices was polyglot architecture)
  • They can be deployed independently
  • There is fault isolation, so errors in one service do not cause other services to stop working

Microservices had proven a popular design choice, there are even patterns for microservices:

  • Decomposition by business capability
  • Decompose by subdomain
  • Database per service
  • API Gateway
  • Client Side Discovery
  • Server Side Discovery
  • Circuit breaker

There are also some drawbacks:

  • A large number of microservices is difficult to orchestrate
  • Testing can be difficult
  • Message flow between services could increase and hamper performance
  • Handling transactions and multiple databases could be painfull

Although they come with their own set of problems, microservices seem to be a very good pattern for decomposing big applications.