Part 4: Advantages of Microservice Architecture
Tags: microservices, softwareengineering
Published: 2024-01-26 14:24:28

Now that we know more about monolith and microservice and we understood more about the characteristics of microservice let's see the advantages associated with it.

If you have not read the previous parts here is the table of contents to go back and read more about microservice fundamentals.

[Part1: Microservice Desing: Fundamentals
](https://dev.to/amirsabahi/microservice-desing-fundamentals-2i54)

[Part2: Microservice Desing: The Monolith
](https://dev.to/amirsabahi/microservice-desing-the-monolith-part-2-j9l)

[Part 3: Key technologies in adopting Microservice architecture](https://dev.to/amirsabahi/part-3-key-technologies-in-adopting-microservice-architecture-3med)

Microservices have many benefits of distributed systems however with the use of:
- Information hiding
- Domain-driven design
- distributed systems
we have more benefits than any distributed system architecture. 

1. Technology Heterogeneity
Microservice brings a versatile approach to technology, allowing different services to use diverse technologies suitable for their specific needs. So you can pick different technologies and even data storage for each service. For example, for a social media service, you can use a graph database and a RDBMS for other services. In addition to that, microservice offers adaptability. You can opt for different programming languages or frameworks on one service without breaking the whole system. This capability is not available in the case of monolith design. Of course, this comes with some challenges. That is why many companies put some constraints on technology choices. However, information hiding makes it possible to change part of the system without affecting other parts of the system.

2. Robustness
Imagine parts of your system can fail, but if this failure does not spread, you can contain the issue, and the rest of the system keeps working. This is called the bulkhead concept. With microservice failure of one service may not affect the whole system.  This is what we do not have in the case of the monolith. If something goes wrong in the monolith, the whole system will be down. Even though we can use replication to eliminate the risk to some degree. Embracing this concept means we need to know what causes failures in distributed systems. Without knowing this or neglecting it, we have a less robust system after migration.

3. Scaling
In monolith systems, we need to scale everything all together. You can not scale a subsystem alone. Microservice offers a solution by allowing us to scale specific services as needed. This enables efficient scaling of the system. For example, Gilt online retailer faced scalability issues with monolith setup. They did transition to microservice and now run over 450 services on multiple machines. With on-demand provisioning systems like AWS, microservices enable cost-effective scaling, aligning architectural choices with immediate cost savings. Microservices provide an adaptable approach to scaling applications, offering targeted scalability and improved resource utilization. 

4. Ease of Deployment
In a monolithic application, a small code change requires deploying the entire system, leading to infrequent, high-risk releases due to accumulated changes. Microservices, however, enable independent deployment of individual services, allowing faster and safer releases with quick issue isolation. This approach, favored by companies like Amazon and Netflix, aims to streamline software delivery by minimizing obstacles and accelerating the introduction of new functionality to customers.

5- Organizational Alignment
Microservices address challenges linked to large, distributed teams and codebases by promoting smaller teams and codebases, enhancing productivity. This architecture enables better alignment between organizational structure and codebase, facilitating adjustments in service ownership as the organization evolves, and ensuring a sustained harmony between architecture and organization.

6- Composable
Microservices enhance composability by offering reusable functionality in diverse ways for different purposes. In addition, microservices enable the opening up of system seams, allowing external parties to address them, and facilitating adaptable application development based on changing circumstances. In contrast, monolithic applications with coarse-grained seams lack such flexibility and require more disruptive changes.