Hello šš» tech enthusiasts!
In this article we explore the journey from monolithic architecture to microservices and the role of containerization in the microservice architecture.
Monolithic Architecture
Monolithic architecture was once the standard for application development. In a monolithic setup, all the components of an applicationāuser interface, business logic, and data accessāare tightly integrated and run as a single unit.
Advantages
Easier to deploy and monitor
Low latency as components in a monolithic interact through the method calls within the same process
Disadvantages
Monolithic applications often need to be scaled as a whole, even if only one part of the system experiences high demand. This results in inefficient resource usage since unnecessary components are scaled along with the rest of the application.
If any part of a monolithic application isnāt scalable, the whole application becomes unscalable.
If any part of the application is changed, then the whole application needs to be redeployed.
Microservice architecture
The disadvantages of monolithic services led to the innovation of microservice architecture.
Instead of building an application as a single, tightly coupled unit, microservices break it down into smaller, independent services. Each microservice is responsible for a specific piece of functionality and can be developed, deployed, and scaled independently.
Microservices perform their work together as a team, so they need to find and talk to each other. When deploying them, someone or something needs to configure all of them properly to enable them to work together as a single system
Independent services which has more traffic only can be scaled instead of scaling the whole application and hence efficient memory usage.
While microservices solve many of the problems associated with monolithic architectures, they introduce new challengesāparticularly in deployment.
Deploying a microservice-based application is more complex than deploying a monolithic one.
Why managing a microserivce deployment is complex ?
Managing a few components (services) is easy, but if services and number of replicas of a services increases then deployment decisions and interdependencies become more complex. Additionally, debugging and tracing execution across multiple processes and machines is challenging.
Components in a microservices architecture arenāt only deployed independently, but are also developed that way. Because of their independence and the fact that itās common to have separate teams developing each component, nothing prevents each team from using different libraries and replacing them whenever the need arises. The bigger the number of components you need to deploy on the same host, the harder it will be to manage all their dependencies to satisfy all their requirements which is referred as dependency hell.
One major challenge for developers and operations teams is managing the differences between development and production environments, which vary in hardware, operating systems, and libraries. These differences arise because developers maintain their own environments, while operations teams manage production systems with a focus on security and stability. Additionally, production systems often host applications from multiple developers, requiring them to support various, sometimes conflicting, library versions. To minimize issues that only appear in production, itās ideal for development and production environments to be identical in operating systems, libraries, and configurations. This consistency helps avoid conflicts and ensures stability when adding new applications to a server.
Containerization
Problems of deploying microservice based application can be resolved using containerisation technologies such as Docker and Kubernetes.
Docker helps to perform CRUD operations on the container. Container is like a lightweight virtual machine which can isolate the process that is running in the container with other processes in the host and also can restrict the memory and cpu consumption for the process.
Summary
We began with monolithic architecture, but its challenges led us to microservices. The deployment issues in microservices were then addressed through containerization.
Thanks for reading the article š
Love to hear your thoughts and suggestions š¬