Exploring the pros and cons of moving to microservices

For many organizations, the conversation around Microservices goes ‘to do or not to do…that is the question’. Some wonder, why fix something that may not be broken? As the world becomes increasingly application-driven, software companies have to look at the challenges that monolithic applications present. 

Be it low developer productivity owing to a codebase that grows as the application grows, difficulty in changing the technology stack, a single point of a failure impacting the whole application, and difficulty in scaling these applications, all become pressing problems that demand solutions.

A primer to Microservices 

Almost an antithesis of Monolithic applications, Microservices, follows the principles of service-oriented architecture (SOA) design and provides a flexible and scalable alternative to monolithic systems. Microservices is a distinctive method to develop software systems that focuses on building single-function modules with well-defined interfaces and operations. 

The approach of microservices is similar to the single responsibility principle – gather things that change for the same reason and separate those things that change for different reasons. 

Microservices employ loosely coupled services that can be developed, deployed, and maintained easily. Each of these services is responsible for a specific task and can easily communicate with other services using API’s to solve a larger and more complex business problem.  

Software guru Martin Fowler defines the microservices architecture as “suites of independently deployable services…organized around business capability, automated deployment, intelligence in the endpoints, and decentralized control of languages and data.”

Applications built using microservices show these characteristics:

  • They contain fragmented, loosely coupled components, each of which has a discreet function.
  • They have built-in individual functions that are aligned to business capabilities
  • They can be easily distributed across data centers and clouds
  • Each function is treated as an independent service and can be changed, updated and deleted without impacting the overall application

In this environment of constant change, this capability brings immense benefits. However, taking a deep dive into Microservices without gaining a complete understanding of its pros and cons is also not advisable. 

Here are the pros and cons of moving to Microservices. 

The Pros

Microservices are becoming hugely popular because they are immensely useful in this era driven by containerization and cloud. Moving to microservices gives you:

Flexibility and scalability – You can develop and deploy each microservice on a different platform employing different programming languages and tools. This capability gives developers the flexibility to choose the programming language and tools best suited for the functionality without coordinating major development efforts with the team. So, while they can use SQL for database, they can use Swift or Java for developing the functionality. Loosely coupled microservices also give teams the capability to scale each service horizontally and independently. 

Freedom from clutter – In a monolithic application, each time a technology depreciates and is replaced by new tools it means adding new tools to the stack. This constant addition makes monolithic applications very large and impacts the speed of future development. Microservices eliminate this clutter as it gives the opportunity to reduce the codebase by removing unused functionalities thereby making future development easier. 

Increase fault tolerance and fault isolation capabilities – Since Microservices are loosely coupled it increases their fault tolerance as one service failing does not impact another. Unlike a monolithic architecture where the application exists as one gigantic block of code, one feature crashing can lead to the entire system crashing. Locating issues also become a big challenge, one which does not happen in microservices. Owing to the loosely coupled structure, locating and isolating issues becomes faster leading to lower resolution times. This also helps to monitor application security robustly as it becomes easier to track down and resolve the root cause of a security issue. 

Enable Faster Deployment – The Microservices architecture is perfectly suited for the Agile, DevOps, CI/CD culture that thrives on automation and fast deployment speeds. Microservices makes it possible for different teams to work independently on different modules without any dependence on others to complete a task to move forward. They are also easy to find, modify, and perform QA testing. This also gives small teams the opportunity to develop, test, and deploy multiple modules separately. This helps organizations increase their development output without adding resources.

The Cons

The pros of microservices are quite substantial. However, that does not entirely rule out the presence of cons, which though minor and easy to mitigate, should also be listed.

  • Global testing becomes slightly more complicated with Microservices since the components are all distributed
  • It is imperative to control the number of microservices in a solution since it can be difficult to manage and integrate a large number of microservices into one solution. Service dependencies can also create information barriers.
  • In the absence of established standards and best practices, each service can handle error handling differently and generate a significant amount of unnecessary code. It thus becomes imperative to introduce standards and best practices when there are multiple teams taking care of different services.
  • While microservices are fault-tolerant, this resilience does not come by default. Failures independent services, bugs in code, network time outs, etc. are few things to keep an eye out for. 

So, should you use Microservices or should you stick to monolithic architectures? Microservices allows an application to be split and supports the separation of responsibilities. This is critical for developing highly scaled applications. This allows the application to grow as the organization and its requirements grow. 

However, you need to pay close attention to how you plan to break down all the functionality and dependencies. Despite the complexities involved, Microservices, when used effectively, delivers on its promised benefits. As the application economy thrives and businesses insist on increased speed to respond to market demands, it is only a matter of time before all software organizations start looking at Microservices as their ‘go-to’ architecture. 

Leave a Reply