May 3, 2021

Everything About Microservices: What, Why and How!

Arti Agarwal

Everything About Microservices: What, Why and How!

Microservices architecture is a type of software architecture that is growing in popularity with developers and product managers, and finds many use cases which are not possible with the traditional monolithic software architecture. There is no formal definition of microservices, but in the words of Martin Fowler,

'The term "Microservice Architecture" has sprung up over the last few years to describe a particular way of designing software applications as suites of independently deployable services. While there is no precise definition of this architectural style, there are certain common characteristics around organization around business capability, automated deployment, intelligence in the endpoints, and decentralized control of languages and data.' — Martin Fowler

Microservices architecture, also known as microservices service-orientated architecture, refers to a type of approach towards software design where the application is made up of several independent service units, each of which communicates with the other via APIs and runs its own independent processes. It is decentralized to a great extent, and each service unit can use a different programming language, based on business capability, and a different data storage technology and deployed independently as well.

Features and Characteristics of Microservices Architecture

Microservices have certain distinguishing features which make them a viable choice for many applications. Microservices are:

  • Loosely coupled
  • Independently deployed
  • Based on core business capabilities
  • Integrated via APIs, which are plug-and-play
  • Run their own processes, hence easily testable and deployable
  • Typically owned and managed by different teams

These features make it easy for applications to be scaled up and allow for greater innovation and features in an application. On the flip side, it also requires better communication and documentation of the code, as well as coming together of multiple teams to manage the product. The high degree of independence makes microservices viable in many industries, especially those which are constantly innovating and incorporating user-feedback into the application.

A Modern Microservices Vs A Traditional Monolithic Architecture

A monolithic application is built as a single unit. Most applications have three parts to them—the client interface, the database, and the server side application. The convention for software architecture for the server side application has been monolithic in structure. Although there are a few advantages to the monolithic architecture, which is why it has been used conventionally, there are growing disadvantages as well; this is where microservices architecture finds more utility.

Single Logic Execution in Monolithic Architecture

A monolithic structure has a single logic execution system. So, all the software is in one programming language, and any updates to a part of the system requires the whole to be updated and deployed, as it is a single process that is executed.

Every time a small change is made to the application, the entire application needs to be rebuilt and deployed—this considerably slows down the process of updation. Monolithic applications are built on modular structure, using classes and functions, which enables them to function as separate parts of one program. But with more changes to the application with time, the modular structure may not remain intact and changes to one module of the program may affect other modules as well. This poses challenges in scaling the application and adding new features with time.

APIs as a Bridge Across Services

On the other hand, microservices design involves a suite of services, which are inter-connected with APIs, but function independently of each other, ensuring no spillover of errors to other parts of the whole application. Microservices typically use smaller server side applications and use a REST service to call services as required. Scaling is simpler, as it involves adding another service to the existing suite, rather than integrating a new feature into a monolithic program.

Checkout this Microservices vs Monolithic Architecture article on Stackoverflow

Benefits of a Microservices Architecture

A microservices architecture offers some key benefits, which make them viable for application development.

Technology Heterogeneity

The most important aspect of architecture of microservices is for an application which comprises multiple, collaborating services. Microservices architecture allows one to use different technology for different services rather being encumbered with a one-size-fits-all technology, which may not be the best for all the services. This heterogeneity allows higher performance and flexibility for each service, since the technology used can be the best for that particular service, rather than the overall monolithic architecture.

Resilience

Bulkhead aspect of microservices make it far more resilient than the conventional monolith. When there is a failure, it is easy to isolate and limit the failure to that particular component, thus allowing the rest of the application to still function normally. Whereas in a monolithic service, if one module has a failure, everything stops working and the consequences are more severe. It can lead to higher downtime and costs. This one aspect alone is an important one. If, for example, the booking system on a food delivery app stops working, that should not lead to the entire app not working. If the app stops working, it may lead to customer frustration and app uninstall. Whereas glitches with booking can be resolved much sooner and the customers can be informed of the glitch in time, so as to manage customer satisfaction better.

Scaling

Scaling a monolithic service requires scaling everything together, which is neither easy, nor always required. If a certain component is the constraint, in a microservices architecture, only that component can be scaled, without affecting the rest of the application. Microservices use pools, clusters, grids to scale up efficiently. This considerably affects time to deploy, costs and efficiency of an application. It also avoids undesirable results from scaling the components of an application that did not require scaling in the first place, but were forced to scale up due to the monolithic design.

Have you checked out this article on 5 Factors of Building a Scalable Application

Ease of Deployment

Microservices have a much shorter build + test + deploy cycle. To make a one line edit in a million-line monolithic code requires the entire application to be re-deployed. This is considerably slow and causes higher downtimes. This is a large-impact, high-risk type of deployment, which cannot be carried out too frequently because of the fear of failures. With microservices, it is possible to make changes to one component and deploy it independently of the rest of the system. It also allows flexibility in terms of service-specific security, persistence, monitoring and replication.

Organizational Alignment

Microservices allows better alignment with the organization, reducing the number of people working on a particular service. In a monolithic architecture, because of the nature of the work, there may be too many overlap of roles and responsibilities. On the other hand, microservices involves separate teams for each component, thus also allowing you to manage team sizes based on each service, and negligible overlap in responsibilities from one team to the other.

Composability

As a distributed system, microservices allow for better reuse of functionality. It allows the functionality to be reused in different ways, for different purposes.

Optimizing for Replaceability

Most big corporations or medium sized companies who have seen more than a few Suns have an ugly legacy system in their application which nobody replaces, despite challenges with it, because the risk to touch the system is too high. This is characteristic of a typical problem which many developers face—one which can be eliminated with microservices architecture. The feasibility of replacing any component in entirety is much higher in microservices. The downtimes are much lower and possibility of upgradation is much better. A particular component, if it becomes redundant, can also be completely deleted, without affecting the application.

Examples of Big Companies Which Use Microservices Architecture to Grow

Some of the fastest growing companies today use microservices architecture in their systems.

Amazon

Amazon is one such example. From user management to personalization to ecommerce to infrastructure management—each part is a separate component. Since its early days, Amazon had a razor sharp focus on building every system as an independent component, which would be a system on its own, managed by its own team. There was to be no crosstalk between different components, apart from via APIs. This allows Amazon to scale up and go on building its suite of services at a fast pace, without losses in downtime or troubles with management of growing systems.

Netflix

Netflix implemented systems for monitoring and fault tolerance early in their deployment. Their approach would have been a nightmare to execute in a conventional, monolithic architecture. This is from the official Netflix Tech Blog:

The service-oriented architecture at Netflix allows each team freedom to choose the best transport protocols and formats (XML, JSON, Thrift, Protocol Buffers, etc) for their needs so these approaches may vary across services.

Microservices applications have a higher emphasis on real-time monitoring of the application and business relevant metrics. This makes way for an implementation system that includes early warning systems for something going wrong, making it easier and faster to investigate and fix the issue.

Be it Uber, Zomato, Netflix or any other burgeoning tech company, microservices applications are growing in size and number with every passing year, and for good reason.

Common Types of Microservices

The possibilities of feature addition with microservices are not technically infinite, but practically infinite. Every new feature can be a separate service, integrated into the application. Some of the most common services that find use in microservices architecture are

  • User profile management
  • Customer order management
  • Customer chat
  • In-App Chat and Messaging
  • Payment systems
  • Ecommerce management
  • Delivery management
  • Rewards program management
  • Product recommendation engines
  • Customer service
  • Background and security checks of users
  • and many more...

These are some of the most common types of microservices which we use every day, without knowing that it is implemented into a system as a microservice. CometChat provides in-app chat as a microservice, which can be built into any application with our APIs. The chat SDK allows integration into any type of application, making CometChat a snug fit.

What does the future for Microservices look like?

With the growth of decentralized and distributed systems, and mobile applications and browsers, along with a higher emphasis on data privacy and security, monolithic architecture will not be the best suited to address all these requirements. Although most companies start with a monolithic architecture, over a period of time, incorporating all this functionality makes it tough to stick with a monolithic structure, and microservices are far better positioned to solve the problems of the next few decades. With deployment on the cloud on the rise, microservices will be a better choice to deploy independent services on the cloud. It allows companies to keep up with the modern DevOp practices.

This trend is proven by some of the biggest leaders in the technological space adopting microservices to scale their applications, and is likely to spread even more in the decades to come, to small, medium and large scale corporations.

CometChat is making it simple and smooth to add in-app chat and messaging in any application. To get started with in-app chat and messaging as a microservice for your company, get in touch with us today.


If you like this article, check out these related articles -

  1. 13 APIs to Build Your Own Dating App
  2. 9 No-Code Apps to Help You Build a Better Product
  3. 13 Top APIs For Building Your Own Telehealth App
  4. 13 Developer-friendly To Build A Modern Virtual Events Platform

About the Author

Arti Agarwal is an alum of IIT Roorkee & MIT. She has pursued advanced education in Data Science and Economics. She's a published author and writer and winner of the "Most Influential Content Marketing Professional" Award by the World Marketing Congress in 2017.

Related Posts

No items found.

What Is CometChat?

The most robust suite of cloud-hosted text, voice and video solutions on the market. CometChat seamlessly integrates onto websites and apps quickly and securely, powering digital communities across the globe.