Microservices

Microservices is the method to build application as a collection of loosely coupled services.

Monolithic Architecture

Monolithic is the traditional way of building application. For a monolithic architecture, application is built and deployed as a single unit.

Benefits of Monolithic architecture

  • Simple to develop
  • Easy to make radical changes to the application
  • Straightforward to test
  • Straightforward to deploy
  • Easy to scale

Problems with Monolithic architecture

  • Too Complex and too large for developers to work on
  • Slow start-up time
  • Difficult to do continuous deployment
  • Slow to adopt changes

Microservices

Acording to Chris Richardson, the author of Microservices Patterns, Microservices - also known as the Microservice Architecture - is an architectural style that structures an application as a collection of services that are

  • Highly maintainable and testable
  • Loosely coupled
  • Independently deployable
  • Organized around business capabilities
  • Owned by a small team

Advantages of Microservices

  • Services are small and easy to understand and maintained
  • Face iteration
  • Scalable
  • Adopt new technology easily
  • Fault tolerant - problems with one service doesn’t affect others

Disadvantages of Microservices

  • Developers has to deal with distributed system, which is difficult
  • Transaction span multiple services is hard to implement
  • Hard to test application
  • Features span multiple service require careful coordination

Microservices vs SOA

  • Service Granularity: services within SOA range in size. It can be very large enterprese service.
  • Component Sharing: SOA emphasize sharing. Miscroservices try to minimize sharing through “bounded context”.
  • Protocols: SOA favors remove access protocols(e.g. SOAP). Microservices rely on REST. gRPC can be used and it is getting popular.
  • Middleware vs API: SOA relys heavily on middleware. The messaging middleware can have a large capabilities such as message mediation and routing, message enrichmemtn and message protocol transformation. Microservices have an simple API layer between service consumer and service provider. It uses HTTP for syncrhnous communication and messaging system for asynchronous communication. common message brokers are RabbitMQ, ActiveMQ, Kafka.

Summary

Like Monolithic, Microservices has its own challenges. However, Microservices is the better choice than Monilithic Architecture when it comes to handling complexity. It is the architecuture of the future software development.

Good Reads

Reference