Traditionally, enterprises relied on a unified model for designing a software application. Here, key capabilities for managing input/output processing, error-handling, and UI are packaged into one monolithic process. In such a structure, all the application components are interconnected and interdependent.
Such a structure, however, limited the scope for an application to expand and scale. This is when microservices came into the picture. Here, a single monolithic system is broken down into a set of smaller services, carrying out a functionality in a distributed manner. Its loosely coupled structure enabled enterprises to add or iterate any component of an application independently. This gave scope for scaling and expansion at a much faster rate.
Apart from providing agility to enterprises and making the architecture scalable, microservices enable DevOps automation with continuous delivery and deployment. This makes deployment processes swift and improves time to market. With continuous delivery, iterations can be carried out throughout the product lifecycle, resulting in better working software. Such flexibility is difficult to achieve with a monolithic architecture. More precisely, the very problem of cost and time can be overcome with microservices.
Taking a cue from this, Amazon migrated to microservices. In 2001, the Amazon retail website was developed based on a monolithic architecture. This slowed down development cycles and restricted their ability to innovate. Once they adopted the modular design, it dramatically improved their front-end development lifecycle. Thanks to a microservices continuous delivery process, Amazon can now make 50 million deployments a year.
It’s the same story with Walmart, where they could not handle 6 million page views per minute with their aging monolithic architecture. After embracing microservices in 2012, Walmart experienced 20-50% cost savings and conversions went up by 20% overnight.
With that said, it is not that microservices are without any drawbacks. Although breaking down an application into smaller components have its advantages, it also distributes the complexity of maintaining them. Things can get more complicated with multiple databases and transactions. To make it uncomplicated, microservices architecture relies on APIs to deliver services. APIs bring in the standardization of interfaces in the development process. Structured APIs behave in a manner that is bound to remain unaffected by the technology used underneath. While developing applications, developers can work on coding the core functionality of the application. Other third-party services provided by the application can be called through APIs, thereby reducing the development time.
In a microservices-based architecture, multiple micro apps interact with each other using APIs. The benefit of such a structure is that, if need be, only a part of the application can be scaled by adding more hardware resources. Unlike in a monolithic app structure, where the entire app has to be scaled.
With the increasing popularity of cloud computing, containerization, and APIs, microservices are becoming more reliable. This trend in code management and deployment is enabling companies to respond to shifting customer demands in a swift and agile manner. But, as with any modern technology, a genuine requirement needs to be identified first to reap its benefits.
Update: This blog post was also published in DZone.com