Firstly, let’s start our doubts about what are microservices? What it is especially? Microservices are a way of dividing large software projects into small integrated modules that communicate each other through easily written APIs (Application Programming Interfaces).
Microservices have become more popular over the past few years. They are aMicroservices have become more popular over the past few years. They are a good way of the modular architectural style, based on the philodophy of breaking large software projects into smaller, independent and loosely coupled parts, which has gained prominence among developers for its dynamic and agile qualities in API management and execution of highly defined and discrete tasks. Each of these services is responsible for discrete task and can communicate with other services through simple APIs to solve a larger complex business problem.
Advantages of microservices
The advantages of microservices seem strong enough to have convinced some big enterprise players such as Amazon, Netflix, and eBay to adopt the methodology. Compared to more monolithic design structures, microservices offer:
- Improved fault isolation – larger applications can remain mostly unaffected by the failure of a single module.
- Eliminate vendor or technology lock-in – microservices provide the flexibility to try out a new technology stack on an individual service as needed. There won’t be as many dependency concerns and rolling back changes becomes much easier. With less code in play, there is more flexibility.
- Ease of understanding – with added simplicity, developers can better understand the functionality of a service.
- Smaller and faster deployments – smaller codebases and scope, quicker deployments, which also allow you to start to explore the benefits of Continuous Deployment.
- Scalability – since your services are separate, you can more easily scale the most needed ones at the appropriate times, as opposed to the whole application. When done correctly, this can impact cost savings.
Disadvantages of microservices
Microservices may be a hot trend, but the architecture does have drawbacks. In general, the main negative of microservices is the complexity that any distributed system has. Here’s a list of some potential pain areas:
- Communication between services is complex – since everything is now an independent service, you have to carefully handle requests traveling between your modules. In one such scenario, developers may be forced to write extra code to avoid disruption. Over time, complications will arise when remote calls gain latency.
- More services equals more resources – multiple databases and transaction management can be painful.
- Global testing is difficult – testing a microservices-based application can be bad. In a monolithic approach, we would just need to launch our WAR on an application server and ensure its connectivity with the underlying database. With microservices, each dependent service needs to be confirmed before testing can occur.
- Debugging problems can be harder – each service has its own set of logs to go through. Log, logs, and more logs.
- Large vs small product companies – microservices are great for large companies, but can be slower to implement and too complicated for small companies who need to create and iterate quickly, and don’t want to get bogged down in complex orchestration.