Browse by Domains

Microservice Architecture – Everything you need to know about in 2021

We have been designing systems and applications for several years now and getting better at it day by day, but the tech world is all over microservices. Why? Because microservice architecture is a service-oriented architecture pattern that can break up monolithic applications into smaller service units. 

For business enhancement, many companies/industries have started using microservices.

Why are Microservices used?

Microservices were used to overcome the challenges of monolithic. Monolithic architecture is similar to a big container wherein all the software components of an application are assembled and packaged.

Let me explain to you the disadvantages of monolithic architecture:

  • Inflexible: Monolithic is inflexible, i.e. it cannot be built using different technologies.
  • Unreliable: Monolithic is unreliable as it depends on the entire system, even if one component in the system does not work the entire system does not work.
  • Unscalable: The application needs to be updated every time, which is unscalable.
  • Slow Development: Every feature has to be built one after the other; this takes a lot of time. 
  • Unfit for Complex Applications: Monolithic architecture does not fit for complex applications due to its slow development process, less flexibility, etc.

So these above disadvantages of monolithic architecture have led to the evolution of microservice. So, now let us understand what Microservices is in simple words?

Also read: Migrate Monolithic architecture to Microservice architecture 

What is Microservices?

Microservices is also called microservice architecture which is an organizational approach to software development where software is composed of small independent services that communicate over APIs which are well-defined.

  • Highly maintainable and testable
  • Loosely coupled
  • Independently deployable
  • Organized around business capabilities
  • Owned by a small team

How does Microservices Architecture work?

The microservice architecture contains components depending on the business requirements.

API Gateway-   Clients need API Gateway as it is an entry point, which forwards the call to the specific services on the back end. Here API gateway helps in collecting the responses from different services and returns the response to the client.

Microservices- As the name itself suggests that microservices are the services that help in dividing the service into small services that perform a certain business capability like user registration, current orders, or wish list.

Database- Microservices can either share the same database or an independent database.

Inter-microservices communication- REST or Messaging are the protocol to interact with each other.

Now, let us learn more about the features of microservices.

 Microservices Features

  • Decoupling: Microservices systems are largely decoupled from within which can be easily built, altered, and scaled.
  • Componentization: Microservices can be easily replaced and upgraded as independent components.
  • Business Capabilities: Microservices focus on a single capability. 
  • Autonomy: Developers and teams can work independently without much dependency, thus increasing speed.
  • Continuous Delivery: Microservices is here to update frequently, through systematic automation of software creation, testing, and approval.
  • Responsibility: Microservices is responsible enough to focus on products.
  • Decentralized Governance:  Microservices do not have a standardized pattern that makes the developers have the freedom to choose useful tools to solve their problems.
  • Agility: Microservice is known for quick adaptation of any new feature and even discard the feature. 

Advantages & Disadvantages of Microservices 

Advantages

  • Small in size: Microservices is an implementation of SOA design pattern. Hence, it will be small in size and easy to maintain than any other monolithic application.
  • Focused: Each microservice should be full stack in nature and designed to deliver only one business task which helps in focusing the deliverability.
  • Autonomous: Microservice is an autonomous business unit of the entire application that makes the application more loosely coupled, which helps to reduce the maintenance cost.
  • Heterogeneity: Microservice is a heterogeneous system that supports different technologies to communicate with each other, which helps the developers to use the correct technology at the correct place. 
  • Ease of deployment: Microservices is easy to deploy as the entire application is divided into small pieces of units; every component should be full stack in nature. 

Disadvantages

  • Distributed system: We saw that microservice is heterogeneous, which requires a set of skilled professionals to support this big heterogeneous distributed software. Hence, this stands as the number one disadvantage of using microservice.
  • Cost: Microservice requires different server spaces for different business tasks. Hence, it is costly!

Microservice Vs SOA

The following table helps to know the importance of using microservice over SOA.

Component SOAMicroservice
Design patternSOA is a design standard for computer software.Micro Service is a part of SOA. It is a specialized implementation of SOA.
DependencySOA is dependent on each other.Microservice is independent.
SizeSoftware size is bigger than the conventional software.The software size is small.
TechnologyThe technology stack is less than Microservice.Microservice is heterogeneous.
NatureMonolithic in nature.Full-stack in nature.
DeploymentDeployment is time-consuming.Deployment is very easy. 
Cost-effectivenessMore cost-effective.Less cost-effective.
ScalabilityLess compared to Microservices.Fully scaled.

Docker and Microservices

  • Microservices are usually deployed in containers and here docker is one of the most popular container solutions. 
  • Docker is a virtual machine that is lightweight and this helps developers to deploy microservices more efficiently.
  • Docker allows microservices to be divided into smaller pieces of code and created as docker images and name them as docker files which helps in linking microservices into a large application much easier.
  • Microservice systems are usually built of several Docker containers, this helps in communication between the servers with the Docker Compose environment.

Docker with Kubernetes can lead to better results. However, these two aren’t competitors.

Microservices and Kubernetes

Kubernetes is an open-source system for automating the deployment, and management of containers. 

Things that can be done  with Kubernetes are :

  • With the help of Kubernetes, one can split the app into small containers that run on different cloud environments.
  • Integrate and orchestrate containers.
  • Manage to test inputs and outputs efficiently.
  • Scale apps in less than a minute which helps in faster time-to-market.
  • Migrate from vendor to vendor without having to make major changes in your processes.
  • Use a configuration file to manage them declaratively.
  • Automatically restart, replicate, apps to heal independently.

Building Microservices architecture

Microservices can be built on different frameworks. Here are the most popular ones:

  • Spring Boot with Spring Cloud
  • Vert.x
  • Akka
  • Quarkus
  • Falcon 
  • Molecular 

How to deploy microservices?

There are several options to deploy microservices some of them are :

  • Microservices can be deployed on the cloud to serve a lot of users from different locations.
  • Microservices can be deployed on containers, to reduce the time taken to solve issues, time-to-market, etc…
  • Microservices can be deployed on  PaaS (Platform-as-a-Service).

What cloud provider to use?

Here are some of the options:

  • AWS cloud provider is suitable for almost any kind of technology.
  • An azure cloud provider is suitable for the .NET stack, which mainly helps in data storage, and hosting solutions.
  • Google Cloud Platform is suitable for AI & data analytics and has great support for Kubernetes.

How to monitor microservices?

There are many tools you could use to monitor :

  • The Datadog tool is helpful in bug detection and performance degradation and it is also effective in monitoring, tracing log analytics, and alerting.
  • Dynatrace tool helps in monitoring dynamic, hybrid cloud environments and this is an AI-powered platform.
  • NewRelic tool helps in reporting and monitoring for cloud environments.
  • Splunk tool is used in log analysis.
  • AppDynamix tool helps in monitoring real-time server performance.
  • Zabbix tool is exclusively for performance monitoring.

Examples of Microservices Architecture

Magazine company

  • Magazine Publication could have the following microservices: Microservices like editors, authors, photographer, and legal team are deployed on the admin website portal, while the customer microservice is deployed on the mobile app. Here is the Model:

Amazon

  • Amazon works on thousands of microservices on Shopping cart details like orders, login, wish-lists, and payment gateways. 

Netflix

  • Netflix which handles more than 2 billion API edge requests every day is the first company to implement the microservices architecture on a large scale. 

When to use Microservices?

Microservices architecture is used :

  • When you have many new features coming up.
  • When you’ll be releasing features often.
  • When you have many subdomains.
  • When your company is planning to grow.
  • When you have a large team that can work on different microservices at the same time.
  • When you have agile, cross-functional teams that collaborate on large projects.

Microservices is a revolution in software architecture. Every organisation is taking help from microservices to build their applications. As discussed above, many companies like Netflix, Amazon, Uber, and Spotify are using microservices and taking advantage of them. If you wish to learn more such concepts and build a career in this field, join Great Learning’s PG Cloud Computing Course and upskill today.

Ranjitha S

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top