Before we start learning about microservices we need to understand , why this new architecture is gaining popularity. From inception of software design what needed to be improved which brought this new concept . We need to understand a work “Monolith”
Monolith refers a kind of software which keeps all the component required by it within itself. Say we have to create a E Commerce we need to have User authentication, product services, cart management, payment integration ,recommendation service etc. A monolith is one application which has all of them embedded to it.
Microservices as certainly a buzz word all around. We have been in an era where distributed and scaleable systems have need of the hour. As the business grows the number the pressure on systems also increases. In order to keep up with increased load we scale our application. In this process we end up scaling entire monolith. In monolith we have all modules added to single application. While our load will be for certain modules ,we still end up scaling entire application.
In above example , if we have a E commerce service as monolith, it is expected to have more hits at product and search modules rather cart and delivery tracking modules but when we scale up we will end up scaling all of the modules. This will increase memory and heap size and will require unnecessary resources.
Microservices solves exact same problem. In microservices we have well defined modules as a separate service all of them talking independently via HTTP/MQ or any protocol. Now once we notice increase in product services and search module, we will scale only that component.
While microservices have obvious benefits , it is not the silver bullet to solve all of the problems. We need to think before breaking a monolith to microservices or designing a new mocroservices architecture that do we really need it.
We will decide if we require Microservices by understanding the advantages and drawbacks of microservices. We will look it in next section.