Introduction to Microservices

Reading Time: 3 minutes

What are microservices ?

Microservices is a specific method of designing software systems to  structure a single application as a collection of loosely coupled services.

Microservices are those services that works together but deployed and managed independently. In this model we split the application into smaller mini applications called services. And then we deploy these mini applications on different machines(servers). These applications shared the resources to each other over the network and work together as the bigger one application. In this approach, the application is built as a set of services and each service runs in its processes and communicates through APIs.

These services may be written in different programming languages and may use different data storage techniques.

By using this architecture we can scale or update each service without disrupting other services in the application.

For example: E-commerce websites.

We can create a shopping application and deploy it on a separate server. The order processing(service) will be on another server and the user profile application(service) on another server however if the user wants to see the shopping catalog the view application which is another application(service) makes a REST API call to the catalog application API to get the list of products to show and the API returns the list and then view application returns the HTML page to show. So these mini-applications(microservices) communicate to each other over the network by calling each other’s REST APIs. The communication between microservices is a stateless communication where each pair of requests and responses is independent.

A normal working diagram.

Instead of a monolithic architecture, each component of a microservice architecture has:

  • Its own CPU
  • Its own runtime environment
  • Often, a dedicated team working on it that own the entire lifecycle of the service. Ensuring each service is distinct from one another.

Examples of microservices

Many large companies now utilize microservices within their architecture. 

For example: Amazon, Netflix, Uber, eBay, Twitter and PayPal etc.

Netflix has a widespread architecture that has evolved from monolithic to SOA. Netflix receives more than one billion requests every day, from more than 800 different types of devices, to its streaming-video API.  Each API call then prompts around five additional calls to the backend service.

Advantages of microservices Architecture

  • The applications become easier to build, deploying and managing when they are broken down into services. Though the architecture has increased complexity, microservices still offer several advantages over monolithic architecture.
  • A fairly small team can develop the microservices.
  • Developers can use the latest technologies for the development.
  • Microservices are language independent, in the simplest way, developers can use any language to write them.
  • Easy to understand and modify for developers, thus can help a new team member become productive quickly.

Difference between Microservices Monolithic architecture.

  • In the monolithic model, the entire application is built in a single monolith and deployed in a single machine, works as a single service. If we want to add some functionality, the whole application will go down for maintenance of a small functionality. As it affects the entire system to manage and scale the application.
  • Microservices solve these challenges of monolithic architecture by being as modular as possible. Microservices architecture helps to build an application as a suite of small services that run in their process and are independently deployable.
  • In the Microservices architecture the fault isolation is easy. Even if one service goes down, other can continue to function.
  • But in the monolithic model fault isolation is difficult, if any specific feature is not working, in order to handle this issue, the application needs to re built and re-tested and also re-deployed.
  • In Microservices, No cross-dependencies between code bases. You can use different technologies for different microservices.
  • In monolithic approach, One function or program depends on others.
difference between microservices and monolithic
Scala Future

Written by 

Aasif Ali is a Software Intern at Knoldus Inc. He has done Post Graduation from Quantum University Roorkee. He has the knowledge of various programming languages. He is passionate about Java development and curious to learn Java Technologies. He is always impatient and enthusiastic to learn new things. He is a quick learner, problem solver and always enjoy to help others. His hobbies are watching Sci-fi movies , Playing badminton and listening to songs.

Leave a Reply