development complexity, scalability, time to deploy, flexibility, operational cost, and reliability. I’ll try to explain each trade-off below… Development Complexity:
Programming Language
Login & Book ticket.
We might consider building the Login service using the Go programming language, on the other hand for Book ticket we can use Python. Management of Code Repository
Monolith: The monolith application usually belongs to a single code repository.
Microservice: Each Microservice requires its own separate code repository.
Note: We might think it’s better to manage a single repository than many, but the development complexity scale radically when more functionality is added to the project. As for microservice we team can work on a functionality independently as all functionality has its own codebase.
Development Cycle
Scalability:
scalability refers to how an application scales up and down when the incoming traffic increase exponentially or there’s a sudden demand on a particular functionality of the application. Traffic
Resource Consumption
Time to Deploy:
Time to Deploy refers to building a deployment pipeline and deploying new features or bug fixes easily. Delivery Pipeline
Flexibility:
Flexibility refers to the ability to incorporate new technologies and adapt to new principles and tooling. There are moments when it’s better to use a different programming language before a specific feature or modify our application for a specific platform.
Monolith: In Monolithic application, this type of modification may lead to rewritten or restructured the entire project prior to that new technology need. This leads to the conclusion that monolith application has a low flexibility rate.
Microservice: On the other hand, each service is purposely built to be loosely coupled and allows independent changes to services as we writing or restructuring one functionality is more achievable than rewriting the entire stack. Operational Cost:
Operational Cost refers to the necessary resources to build, deploy and release a product. A low initial cost to spin up an application is certainly inciting.
Monolith: This is the case we all observe in the monolithic architecture where only one code base is needed and there’s only one delivery pipeline to deploy the entire application.
Microservice: On the other hand, each service requires the maintenance of multiple codebases and delivery pipelines and the dependencies of maintaining different programming languages if we require to use them in a microservice.
This scenario demonstrates the whole application/product development process. The situation is flipped when new functionalities are added and the application needs to be scaled to cope with high customer demand.
Note: Maintaining a monolith over time imposes more complexity and consumes more resources when replication, as we all know maintaining an application, is more costly than developing one from scratch. On the other hand, the Operational cost for a microservice is directly proportional to the required resource at the time. Scalability is performed on each service and adding new components is a defect to operation in an application which makes microservice more scalable than monoliths.
Reliability:
The term Reliability refers to the ability to recover from failure and waste monitoring the application all the time.
Monolith: If an application goes to a failed state the entire stack will need to be troubleshot and recovered for availability.
Microservice: A distributed amount of functions that interact with each other via the network calls. If a component fails then only that component will need to recovery.
Note: In Microservices, it is possible to have representative metrics and logs of a separate unit while with monoliths getting granular visibility for each functionality is difficult as all the metrics and logs for the entire application will be aggregated together.
Summary
| Trade-Offs | Types | Monoliths | Microservices |
|---|---|---|---|
| Development Complexity | |||
| Programming Language | One language | Multiple languages | |
| Management of Code Repository | One repository | Multiple repositories | |
| Development Cycle | Sequential | Concurrent | |
| Scalability | |||
| High Traffic | Replication of the entire stack | Replication of specific service/functionality | |
| Resouce Consumption | Overconsumption of resources | On-demand resource consumption | |
| Time to Deploy | |||
| Delivery Pipeline | One delivery pipeline | Multiple delivery pipeline | |
| Deployment process | Easy | Comparatively harder | |
| Deployment | Entrie stack deployment | Separate functionality deployment | |
| Velocity | Low velocity at scale | High velocity at scale | |
| Flexibility | Low | High | |
| Operational Cost | |||
| Initial cost | Low | High | |
| Scaling cost | High | Low | |
| Reliability | |||
| Recovery | Recovery of the entire stack | Recovery of the failed component only | |
| Visibility(metrics/logs) | Low | High |
Predefined/Golden rule to build a product, but a good understanding of the trade-offs will provide a clear understanding of the roadmap to build the product goals we’re trying to achieve. Now regardless of what architecture we choose to build the project, as long as the project is coupled with an efficient delivery pipeline and design pattern, the ability to adopt new technologies and how easily we can add the feature to cloud-native deployment remains certain.