MSA(Microservices Architecture)

What Is MSA?

  • Microservices Architecture.
  • It emerged to overcome the limitations of Monolithic Architecture, where every system component is integrated into a single project.
  • It is a framework composed of small, independently deployable services that each perform a specific function.
  • MSA divides one system into completely independent services that can each be deployed separately.
  • Each service exchanges data through RESTful APIs and together forms one large service.
  • It focuses on a single business capability while allowing different technology stacks such as programming languages and databases.

Characteristics of MSA

  • Services can interact only through APIs.
  • Each service exposes its end-point as an API.
  • The practical implementation details are abstracted.
  • Technical details such as internal logic, architecture, programming language, database, and quality management systems are thoroughly hidden behind the service API.

Advantages of MSA

  • Each service is modularized, and modules communicate through RPC, Message-driven APIs, and similar mechanisms.
  • Individual services can be developed quickly and maintained more easily.
  • Each service can use an appropriate technology stack.
  • Services can be deployed independently.
    • Continuous deployment(CD) can also be lighter than in a monolithic system.
  • Each service can scale out independently according to its load.
    • This offers substantial benefits in terms of memory and CPU usage.
  • Even if one service fails, the entire service does not fail.
  • Each service can be built with different languages and frameworks.
  • Services are easy to extend.

Disadvantages of MSA

  • It is relatively more complex than a monolithic architecture.
  • Because services communicate through RESTful APIs, that communication has a cost.
  • Since services are separated, testing and transaction handling are difficult.
    • When communication failures or server load occur, how to maintain transactions must be decided and implemented.
  • Because calls between services are continuous, debugging and integration testing are difficult.
  • Deploying to an actual production environment is not easy.

MSA Server Components

Service Discovery Server

  • Spring: Netflix Eureka

Web Service Client

  • Spring: Netflix Feign

Client-side Load Balancer

  • Spring: Netflix Ribbon

Circuit Breaker

  • Spring: Netflix Hystrix
  • When the failure rate of requests sent from a client to a remote server exceeds a certain threshold, the server is considered problematic, and meaningless requests are no longer sent. Instead, errors are returned quickly(fail fast).

API Gateway

  • Spring: Netflix Zuul, Gateway
  • Reverse proxy server.

Reference