What are Microservices? Advantages and Disadvantages of Microservices Architecture

08 Sep 2022
Beginner
34.8K Views

Traditional monolithic style application architecture coupled all their functionality tightly into one service. This caused high difficulty to deploy new features as it will take long downtimes which resulted in fewer opportunities to make updates to the application. Scaling such applications is expensive because we have to scale the whole application even though only a particular service gets much traffic.

Why Learn Microservices?

The introduction of the cloud has brought a drastic change in the way we design, architect, and deploy our applications. Helped in faster deployments, improving availability, ability to scale on-demand, and reduced the time to market. So here comes the Microservices-based application, which is an architecture in which the goal is to create smaller isolated services that can deploy and scale independently of each other improving agility.

Microservice architecture is one of the booming concepts nowadays that promise quick and flawless software changes compared to traditional or monolithic architectures by modularizing complex applications into distributed parts that run parallel without any harm to another part of the applications. The team of developers composes the overall applications by the resulting in the upgradable, interchangeable, and critical scalable parts of the application. When it comes to the rapid application development era, such kind of modular architectural style surely helps to accelerate the business growth by enabling the agile deployment of the rapid client functionalities. But again, decomposing the part of applications can also come with some complexity compare with the monolithic model.

Microservices Principles

  • Modeled around business domain: Microservices architecture lets us separate system capability into different domains. Each domain will focus on one thing and its associated logic and can easily migrate independently to the next version, and also scale independently according to requirement.

  • Culture of Automation: As we are building, testing, deploying, and monitoring each service separately and there is an increase in the number of deployment units compared to monolithic architecture we should follow the culture of automation by designing it for continuous integration and continuous delivery.

    The smaller and compact codebases and their defined scope are generally turned out to quicker deployments, which also allow us to start to explore the benefits of Continuous Deployment and Continuous integration seamlessly.

  • Hide implementation details: Microservices should be architected in such a way that they won’t expose the internal details; neither technical implementation nor the business rules that drive it. This will reduce the coupling and help to do changes and improvements without affecting the overall architecture.

  • Decentralization: In traditional monolithic implementations, the software is designed to use a single database with different tables whereas microservices are designed in such a way to manage their own database.

  • Deploy Independently: To enjoy the complete benefits of the architecture, microservices should be independently deployable. If you are failing to do so, check for any coupling in the application and solve it.

  • Failure Isolation: The impact of a failure is less in microservice architecture compares to the monolithic type as it will only affect that particular service and its association while other services can keep running. The associated services should handle such scenarios when the dependent is unresponsive or slow.

    The larger or the enterprise applications may remain unaffected mostly by the failure of a single module and due to that, other parts of the application are running concurrently which enhances the availability of the feature to the customers most of the time.

  • Highly Observable: The services should collect as much information to analyze what is happening within each of them like log events and stats.

Monolithic vs. SOA vs. Microservices

Monolithic architectures are the simplest form of architecture as it is having only one application layer that bundles together all the software components, and is hosted and delivered together. This type has been widely used by many small and mid-sized companies. The main challenge in this system is during scaling up as we need to duplicate the whole system including all the features of other machines which increases the cost. Also, the failure of one feature will affect the whole system making it unreliable.

Monolithic vs. SOA vs. Microservices

Service-Oriented Architecture (SOA) follows a coarse-grained structure where the features of an application are broken down into smaller components as services comprised of some tasks. This type of architecture allowed us to horizontally scale each service, and also more flexibility and performance at the cost of increasing the complexity of the architecture compared to the monolithic. Each service can be written in different languages and the communication between them can be done with the help of a middleware

Microservices have technically evolved out of SOA where those features are further broken down into tasks level services making it fine-grained architecture. While Service Oriented Architecture followed a centrally governed architecture where each component is controlled by a central middleware, in microservices it’s a decentralized governing system where components talk directly to each other and can be written in different programming languages and communicate without the help of any broker and are done with the help of REST API.

The differences between microservices and SOA can be a bit fuzzy while the technical aspects of both of them can be drawn between the microservices and the SOA architecture somehow, and most probably around the role of the "Enterprise Service Bus", When it comes to the defining difference, it is pretty easy to consider the difference as one of the scopes. The SOA architecture was one of the extensive efforts to standardize the way all the web services work in an organization to talk to and integrate with each other, and when it comes to the microservice architecture, it is a kind of application-specific platform.

Microservices Architecture

An architectural style that structures an application as a collection of small self-contained processes, modeled around a business capability. They don’t share the data structure and will be communicating through APIs. While in a monolithic application all the components are in a single module, in microservices we can see all the components are divided into a separate module and communication happens with each other with the help of APIs. In Microservices Architecture the data is federated where each microservice is responsible for its own data model and data.

Source:https://docs.microsoft.com

Being small in size, independent, and loosely coupled each service can be developed and deployed independently by a small team as each service is having its own codebase. Data and state persistence should be taken with each service as it lacks a separate data layer to handle it. The services only communicate with well-defined APIs hiding each service’s internal implementation from the other. Each service can use a different technology stack, language, libraries, or frameworks.

  • Management: The Management takes care of the placement of services on nodes, checking for failures, and rebalancing services across nodes in case of any failures.

  • Service Discovery: Maintains a list of services and the nodes where each service is located, and also enables the service to look up to find the endpoint for a particular service.

  • API Gateway: The entry point for clients where all the calls from the client will be taken, analyze, and forward to appropriate services. In case some calls are needed from multiple services API Gateway will aggregate and will return the aggregated result.

Companies using Microservices

There are many companies using Microservices for their products and services and here is a list of a few who shared their experiences.

  • Comcast Cable

  • Uber

  • Netflix

  • Amazon

  • eBay

  • Sound Cloud

  • Karma

  • Microsoft

  • Groupon

  • Hailo

  • Gilt

  • Zalando

  • Lending Club

  • AutoScout24

Advantages of Microservices

  • Services can be written in different programming languages and can be accessed by using any framework.

  • Independently develop, deploy, redeploy, version, and scale component services in seconds without compromising the integrity of an application

  • Better fault isolation keeps other services working even though on got failed.

  • Zero downtime upgrades.

  • Services can be of from different servers or even different data centers.

  • Interaction with other services in a well-defined protocol

  • Monitor, capture, and report health diagnostics

  • Reliable and self-healing

  • Supports continuous integration and delivery

  • Easy to transfer knowledge to the new team member

  • Easy to integrate with third parties

Disadvantages of Microservices

  • The additional complexity for implementation of an inter-process communication mechanism between services.

  • Writing automated tests involving multiple services is challenging and It can be difficult to create consistent testing environments.

  • Requires a high level of automation to manage multiple instances of different types of services in production.

  • Everyone has to manage eventual consistency as maintaining string consistency becomes extremely difficult.

  • Managing multiple databases and their transactions is difficult.

  • Inter-process calls are slow.

  • Debugging will become difficult.

  • Complexity in DevOps.

  • Production monitoring cost is higher.

  • Formal documentation overhead.

  • Lack of governance.

Summary

While having both the advantages and the disadvantages of the usage of microservices and the serverless mechanism, it’s clearly visible why the companies opt to decouple their monoliths architecture over other ways of defining architectures. We have checked the advantages of the microservices first-hand, and get to know that this is how much of an impact this transformation of following the best practices of defining the microservices can have on the development performance, efficiency, and the accessibilities. However, it is always an essential thing to understand the challenges and turnaround associated with such a complex initiative.

Microservices Online Training helps you learn how to build microservices using .net core for a software development style to set up practices meant to increase the speed and efficiency of developing and managing applications. This set of practices is technology agnostic, meaning that there is not one single technology or programming language to build microservices. It's more about applying a certain number of principles and architectural patterns that will finally create a microservice architecture. There is no universal measure defining the ideal size of a microservice. Each microservice is supposed to do one thing and do it well. So, the micro refers to the scope of the service functionality, not the lines of code.

Also, Read - Best Microservices interview questions Answer

Learn to Crack Your Technical Interview

Accept cookies & close this