Microservices, is a software design pattern that tries to focus on building single-function modules with well-defined interfaces and operations. The microservices architecture pattern is getting a lot of attention these days and it’s trending, as Enterprises look to become more Agile and move towards a DevOps and continuous testing.
A Microservices Architecture makes more sense when we compare it with monolithic application design. In monolithic architectural design we create a big cumbersome application with all of the components of the application reside in one area, including the UI layer, the business logic layer, and the data access layer. Building applications in a monolith is an easy and natural process, and most projects start this way.
Lets take an example of e-commerce application, there standard features like Customers, Products and Payments. These features are accessible to customers using their browser or apps. When the developer of the eCommerce site deploys the application, it is a single Monolithic unit. The code for different features like Customers, Products and Payments are on the same server. To scale the application, you need to run multiple instances(servers) of these applications.

There are some disadvantages to this architectural design,
- As monolithic applications grow in size, due to tight coupling between components, release becomes difficult and frequent releases are not possible.
- Similarly as application grows, the ability to move to a different technology stack becomes more and more difficult.
- Making changes to the codebase affects the entire application, no matter how small
Let’s take the monolith example from above and convert it to use microservices,

- Microservices Architecture they are spread into individual modules(microservice) which communicate with each other.
- The communication between microservices is a stateless communication where each pair of request and response is independent. Hence, Microservices can communicate effortlessly
- Each Microservice has its separate data store.
With this kind of architecture comes a whole host of advantages:
- It’s easier to separate concerns.
- A microservice can use a different tech stack as needed. Considering rewriting everything in a new language? Just change one microservice to use the new tech stack
- Deployments of the application as a whole become more focused. Microservices give you the flexibility to deploy different services as needed.
Microservices has few challenges,
- Microservice architecture brings plenty of operations overhead.
- As it is a distributed system, it is an inherently complex model.
- Initial investment to run these applications is high because all the independently running components need their own runtime containers with more memory and CPU.
Hopefully now you have a better understanding of what is microservices.