Kush's Blog

Kush's Blog

Microservices

Microservices

What are Microservices

Microservices is an architectural pattern that divides a large application into a collection of separate, modular services. While there is no precise definition of this pattern, microservices can be loosely characterized by businesses decentralizing their data and application into multiple, self-contained code bases.

The concept of microservices has been around since at least 2005, when Peter Rodgers gave a talk about micro-web-services at the Cloud Computing Expo. Since then, the microservices market has exploded. A report from Verified Market Research even expects it to hit $3.1 billion in value by 2026, a growth rate of more than 20% over its value in 2019.

Whether or not microservices are mature is likely an individual opinion, but the tech industry seems to think so--at least based on adoption rates. TechRepublic Premium's research seems to back this up, finding that most organizations are familiar with microservices and 73% have already integrated them into their development processes.

Companies that have begun using microservices reported to TechRepublic that they've seen benefits like faster deployments, greater flexibility in the face of changing conditions, and quick scaling, all of which are to be expected, given what microservices are designed to do.

Those still wondering if microservices are mature enough for their organization need to think of them less as a product and more as a design philosophy. The framework for microservices is there in the current tech world and additional tools aren't needed. Microservice architecture is simply a new way of thinking about designing software that puts the future of applications more in line with the cloud-based, decentralized world of computing that is increasingly becoming the norm.

Pros

  • Microservice architecture gives developers the freedom to independently develop and deploy services
  • A microservice can be developed by a fairly small team
  • Code for different services can be written in different languages (though many practitioners discourage it)
  • Easy integration and automatic deployment (using open-source continuous integration tools such as Jenkins, Hudson, etc.)
  • Easy to understand and modify for developers, thus can help a new team member become productive quickly
  • The developers can make use of the latest technologies
  • The code is organized around business capabilities
  • Starts the web container more quickly, so the deployment is also faster
  • When change is required in a certain part of the application, only the related service can be modified and redeployed—no need to modify and redeploy the entire application
  • Better fault isolation: if one microservice fails, the other will continue to work (although one problematic area of a monolith application can jeopardize the entire system)
  • Easy to scale and integrate with third-party services
  • No long-term commitment to technology stack

Cons

  • Developers have to put additional effort into implementing the mechanism of communication between the services
  • Handling use cases that span more than one service without using distributed transactions is not only tough but also requires communication and cooperation between different teams
  • Due to distributed deployment, testing can become complicated and tedious Increasing number of services can result in information barriers
  • The architecture brings additional complexity as the developers have to mitigate fault tolerance, network latency, and deal with a variety of message formats as well as load balancing
  • Being a distributed system, it can result in duplication of effort
  • When number of services increases, integration and managing whole products can become complicated
  • In addition to several complexities of monolithic architecture, the developers have to deal with the additional complexity of a distributed system

Why Microservices?

To understand the popularity of microservices, it’s important to understand monolithic applications. Any application will consist of a client side interface, a database for storing and handling data, and server side logic. A monolithic application is built as one single unit. In a monolithic application, server side logic is bundled together in the form of a monolith, with all the logic for handling requests running in a single process. All updates to this system will entail deploying a new version of the server side application. While there are, and have been thousands of successful monolithic-based applications in the market, development teams are starting to feel the brunt of such large scale deployment operations. For example, in a monolithic application, any small modification is tied to an entire change cycle, and these cycles are invariably tied to one another. Granular scaling of specific functions and modules is also not possible, as teams have to scale an entire application.

Conclusion

Microservices have many benefits for Agile and DevOps teams - as Martin Fowler points out, Netflix, eBay, Amazon, Twitter, PayPal, and other tech stars have all evolved from monolithic to microservices architecture. Unlike microservices, a monolith application is built as a single, autonomous unit. This make changes to the application slow as it affects the entire system. A modification made to a small section of code might require building and deploying an entirely new version of software. Scaling specific functions of an application, also means you have to scale the entire application.

Microservices solve these challenges of monolithic systems by being as modular as possible. In the simplest form, they help build an application as a suite of small services, each running in its own process and are independently deployable. These services may be written in different programming languages and may use different data storage techniques. While this results in the development of systems that are scalable and flexible, it needs a dynamic makeover. Microservices are often connected via APIs, and can leverage many of the same tools and solutions that have grown in the RESTful and web service ecosystem. Testing these APIs can help validate the flow of data and information throughout your microservice deployment.

Interested in reading more such articles from Kushagra Sharma?

Support the author by donating an amount of your choice.