Microservices

This post summarizes ideas about microservices, that is a type of distributed system.

This post is part of a series of articles about distributed systems.

Description of Microservices

IT microservices is a service-oriented architecture (SOA) where the application is splitted into various independent services that perform the simplest operation possible. Because of the simplicity of these services, they are called microservices.

The services are loosely coupled, it means that each other are very independent.

Communication should be enabled between the different services, that are loosely coupled using lightweight protocols. A service mesh can be used to manage this communication.

Popular communication protocols within microservices are HTTP/REST, including its variant RESTful API, gRPC, or messaging (as for example, RabbitMQ or Apache Kafka).

Containerarization is an essential part of microservices as they can be easily exported and imported between different systems. You can read more about containerization on this post.

The more traditional alternative to microservices is monolith architecture.

A single microservice usually takes 2 weeks to be implemented. If it takes more, it is a signed that more than a microservice .

A microservice usually corresponds with an user case diagram.

Microservices may be grouped by modules or subsystems.

Each microservice has its own database.

CQRS may be used to write on tables. This topic may be more connected to NoSQL databases.

There is client-side integration and server-side integration differs where the different parts generated of an application are integrated.

The communication between microservices can be achieved using message-oriented middleware (MOM). You can read this post about MOM.

Advantages of Microservices

Microservices are highly reusable in different projects, because each service solves a very basic problem that may be common to many applications.

This independence between microservices allows to be able to update a microservice without touching the other microservices.

Disadvantages of Microservices

Microservices increases complexity in communications in comparison to monolith architecture because it requires to manage the communication between separate entities.

Though microservices are independent between them, the applications using them are highly dependant on them, so any change on them may affect the application.

Microservice Architecture

The users must be represented first, and the type of devices or technologies they are using.

Elements:

  • Presentation (either before or after the API gateway)
  • API Gateway
  • Back-end
  • Message broker / Service bus
  • Orchestration

An API gateway is set before the microservices. It also connect to external services.

An example of AP gateway is WSO2.

In case of server-side rendering (SSR), users are connected directly to an API gateway, and after that all the front-end microservices. These are connected to back-end microservices hitherto.

In case of client-side rendering (CSR), there is a presentation layer (UI) between the API gateway and the backend for each device or technology. These individual elements are called microservices calls.

When there is a web and there is a mobile app in server-side integration, take into account that the web connects to the front end services but the mobile phone connects to the back end service.

In case the API gateway connects to a external service that doesn’t use RESTful, it may be necessary a external interface microservice.

It is necessary to have container orchestration. You can read this post about container containerization.

You need to represent a message broker or message-oriented middleware (MOM) or message bus. You can read this post about message-oriented middleware (MOM).

Workflow orchestration may be used when talking about complex interaction between microservices in which a certain order must be given. You can read this post about workflow orchestration.2

Recommendation about Microservices

According to some authors like Martin Fowler, it is recommended to start with a monolith architecture before tackling with microservice architecture. Starting a project with microservices may not provide the right outcome.

CD/CI is recommended for microservices.

Microservices Frameworks

Microservices frameworks:

  • Spring Boot
  • Micronaut

Spring Boot is a Java development framework based on Spring Framework. It is suitable for mciroservices.

Micronaut is a Java development framework focused on microservices.

Quarkus is a Java development framework based on containerization through Kubernetes. It is suitable for microservices.

Bibliography about Microservices

This section offers some bibliography and articles about microservices.

Microservices: breaking the monolith

“Microservices: breaking the monolith”

https://dzone.com/guides/microservices-breaking-down-the-monolith

Evolve the Monolith to Microservices with Java and Node

http://www.redbooks.ibm.com/abstracts/sg248358.html?Open

Building Microservices

“Building Microservices”, Sam Newman

Online course: Monoliths to Microservices

“Online Course: Monoliths To Microservices”. Course by Sam Newman offered in O’Reilly Media’s Safari’s platform

Monolith first

“Monolith first” article

https://martinfowler.com/bliki/MonolithFirst.html

You might also be interested in…

External References

Leave a Reply

Your email address will not be published. Required fields are marked *