Microservices – how to better understand their function
Microservices is an architectural style that provides a highly maintainable, testable, loosely coupled collection of services that are independently deployable. It is based on Service-Oriented Architecture (SOA) which means a set of smaller parts communicating with each other.
In the process of building SOA from huge monolithic architecture, the greatest emphasis is on the functional decomposition of the system. Every service has to be rounded whole in terms of business process flows.
The granularity of the SOA is the level of decomposition of the system. It is not strictly defined, but project architects have to find a good balance between a couple of bigger services with easier communication between them or a number of smaller atomic services with complex communication.
When we talk about communication, two services have to talk using the same communication protocol in order to send and receive calls or messages correctly. On the other hand, communication protocols are also not strictly defined which has to be used. The most popular protocols nowadays are REST, SOAP, RPC, messaging, …
Each microservice itself can be implemented in different technology (framework, language, DB,…) which causes a much more flexible technology stack.
Monolithic based architecture
When we are talking about the advantages of monolithic architecture, we usually mention simplicity as the biggest one. Monolithic applications are easy to build, test and deploy. They are scaled horizontally in one direction by running multiple copies of the application behind the load balancer. Also, it is easy to implement AOP over the same code base such as logging, monitoring, configurations, … Components in a monolithic structure share the same memory which is much faster than in an SOA (extra time goes to communication)
Of course, monolithic architecture has its own disadvantages. Most important between them is strong links between entities. This is the biggest drawback as it affects application management, scaling, and continuous deployment (CI / CD).
They also have problems with reliability. An error in any part of the system can cause the entire application to crash.
Code updates affect the entire application. For each and every update, the entire application must be deployed again, no matter how small is the change. An error in any part of the system, on the other hand, can cause the entire application to crash.
Technology stack in monolithic applications must be uniformed. Every change in technology often affects the whole system!
Microservices based applications
The biggest advantage of SOA is loose coupling. Parts of the system are poorly connected which makes them easily replaceable.
Scalability is the next big advantage. Each part of the system (MS) can be scaled separately. Each part of the system (MS) can be updated separately without the need to stop the whole system and it is possible to use different technologies/programming languages during the implementation.
When talking about disadvantages, we can mention complexity as a major problem in SOA. Due to the communication between services, the complexity is higher than in monolithic applications.
Team expertise also plays an important part because people have to know additional patterns/frameworks.
Once the system is divided into components, it is necessary to monitor multiple logs, interactions,… It is necessary to use adequate tools for testing and monitoring.
According to the SOA, data are persisted into multiple databases. This can lead to a much more complex data model than is the case in monolithic systems.
MS architecture – technologies, patterns, concepts
IDE (Integrated development environment)
- Programming language: Java, Kotlin
- Spring Framework, Spring Boot – https://spring.io/projects/spring-boot
- Spring Cloud – https://spring.io/projects/spring-cloud
- Service registration and discovery – Eureka
- Centralized configuration – Spring Cloud Config
- API gateway: Spring Cloud Gateway
- Routing and filtering – Zuul
- Declarative HTTP client – Spring Cloud OpenFeign
- Circuit breaker – Spring Cloud Netflix Hystrix
- Client-side load balancing – Spring Cloud Netflix Ribbon
- Distributed tracing – Sleuth and Zipkin
- Maven – https://maven.apache.org/index.html
- Gradle – https://gradle.org/
- Docker – https://www.docker.com/
- Starting a Eureka server
- Starting clients
- Client registration at
- Eureka server