Menu Close

Microservices Interview Questions

This post of interview question covers basic to advance level of Microservices Interview Questions and will help you to prepare for the interviews. Please check my previous Interview questions set of ASP.NET Core Web API Interview Questions.

What are Microservices?

Microservices are a design pattern in which applications are composed of small, independent modules that communicate with each other using well-defined contracts. Each microservice focuses on a single concept.

Microservice is an approach to create small services each running in their own space and can communicate via messaging. These are independent services directly calling their own database.

Why Microservices is need?

Microservices make it easier to develop, test, and deploy isolated parts of your application. Once deployed, each microservice can be independently scaled as needed.

What are the benefits of MicroServices?

MicroServices Architecture offers many benefits because of its characteristics.

  • Agility – MicroServices are owned by small, independent teams who have a good understanding of business context so that they can deliver quickly. It empowers you to shorten the development time of a service.
  • Flexible Scaling – You can scale a MicroService independently to meet the demand of application. You can control the infrastructure, cost, availability of a business functionality without affecting other services.
  • Easy Deployment – MicroServices relies on continuous integration and continuous delivery. It allows you to push new features very quickly and you can roll-back the code anytime if anything goes wrong.
  • Technological Freedom – You can develop a MicroService using any tool or technology which best fits your requirement. Again, MicroServices are technology agnostic.
  • Reusable Code – MicroServices allows you to write the code or services which can work as components for other business functionality.
  • Resilience – MicroServices are developed with failures in mind – if anything goes wrong with one service then It will not impact other services or it will not crash the entire system instead of degrading just one failure service functionality.

Microservices Architecture

Microservices architecture is an architectural development style that is used to build an application as a collection of narrowly focused services developed for a business domain.

Microservice Using ASP.NET Core

There are various components in a microservices architecture apart from microservices themselves.

Management. Maintains the nodes for the service.

Identity Provider. Manages the identity information and provides authentication services within a distributed network.

Service Discovery. Keeps track of services and service addresses and endpoints.

API Gateway. Serves as client’s entry point. Single point of contact from the client which in turn returns responses from underlying microservices and sometimes an aggregated response from multiple underlying microservices.

CDN. A content delivery network to serve static resources for e.g. pages and web content in a distributed network

Static Content The static resources like pages and web content

What is a monolithic architecture?

Monolith architecture is an architectural development style in which all the software components of an application are clubbed within a single autonomous unit.

Monolithic vs Microservices Architecture

Monolithic applications are more of a single complete package having all the related needed components and services encapsulated in one package. Below are diagrammatic representation of monolithic architecture being package completely or being service based.

Microservice is an approach to create small services each running in their own space and can communicate via messaging. These are independent services directly calling their own database.

What are the main differences between microservices and monolithic architecture

There are below differences between microservices architecture vs monolithic architecture.

Microservices ArchitectureMonolith Architecture
In microservices architecture, we build an application as a collection of narrowly focused services developed for a business domainAll the software components of an application are clubbed within a single autonomous unit.
It is very easy to scale up and down based on demand.It is not easy to scale up and down based on demand.
Each Microservice has its own database.It has a shared database.
A failure of one service doesn’t affect the other services.One failure may cause the whole system to go down.
Smaller and faster deployment. Each service can be deployed individually. You need to Deploy an entire system once.
You can use different technologies to build different services for different business needs. Because every service or module is independent from other services or modules.Impossible to implement different technologies or programming languages. Because everything is tightly coupled.
Communication between services is very complex. In case if your application consists of hundreds or thousands of microservices, then the application becomes really complex. Especially when the services talk to each other.Secure data processing and transferring is easier at the system level.
You need to test each service individually.Test is very easy. 

What are the challenges faced while using microservices?

  • Microservices depend on each other. So, communication between services is challenging. Because if your application consists of hundreds or thousands of microservices, then the application becomes really complex.
  • Individually testing each service is a complex task. 
  • You need to deploy each service individually. So, the deployment of multiple services is very complicated.
  • Cascading of problems to other services.
  • Handling of the messages in the queue is very hard

When to go with microservice architecture?

  • If you want to build a large-scale application then you must go to Microservices architecture.
  • If you want to use different technologies or programming languages in your solution then you must go to microservices architecture.
  • If you want to build multiple independent teams that would work on different functions of your solution then you must go to microservices architecture.

What are the key differences between SOA and Microservices architecture?

There are some differences between SOA (Service Oriented Architecture) and Microservices Architecture.

SOAMicroservices
Service-Oriented Architecture is a design paradigm for computer application, where application components are exposed to the outer world for usage in the form of services.Micro service is a part of service-oriented architecture. It is a specialized implementation of service oriented architecture.
Business units are dependent on each otherAll the business units are independent of each other.
Software size is bigger than the conventional software.Software size is small.
Service-oriented architecture applications are built to perform multiple business tasks.Microservices architecture applications are built to perform a single business task.
It is more cost effective.It is less cost effective.
Deployment is time consuming.Deployment is less time consuming.
Monolithic in nature.Full stack in nature.

What are key Principles of MicroServices?

We have already explained key Characteristics of a MicroService Architecture in question number 2, please go through with that. Additionally, MicroService design has IDEALS Principles similar to Object oriented design has SOLID principles.

  • I – Interface Segregation Principle
  • D – Deployability (is on you) Principle
  • E – Event-Driven Principle
  • A – Availability over Consistency Principle
  • L – Loose-Coupling Principle
  • S – Single Responsibility Principle

How will you monitor a MicroService?

Monitoring is the control system of the microservices. As the microservices are more complex and harder to understand its performance and troubleshoot the problems. Given the vivid changes to software delivery, it is required to monitor the service. There are five principles of monitoring microservices, as follows:

  • Monitor container and what’s inside them.
  • Alert on service performance.
  • Monitor services that are elastic and multi-location.
  • Monitor APIs.
  • Monitor the organizational structure.

Explain the challenges found in Microservice deployment?

A: The deployment of Microservice needs huge investment and a huge infrastructure setup. The management for application, configuration, and staff selection becomes difficult. Moreover, the communication is complex and there are several security threats. At times, it becomes difficult to test and debug the services. An organization needs extreme planning for managing operations overhead.

What are the cases when you need to consider microservice architecture?

Following are the cases where you need to implement microservice architecture:

  • You already use a monolith application and later it advances to a level where there are issues in scaling.
  • You cannot reutilize the modules or components or services over various platforms of projects.
  • Execution of new features is difficult and prone to errors.

Which are the popular companies implementing Microservice architecture? 

The majority of the large-scale websites such as Netflix, Uber, Amazon, eBay, Twitter, and Spotify have adopted microservices architecture.

What are the three broad categories of tests in Microservices.

There are below three broad categories of tests in microservices.

  • System Test (Top-level test): In this category, tests that span the complete system of microservices and are usually implemented through the GUI.
  • Service Test (Middle-level test): In this category, we perform tests against one, but only one, complete microservice.
  • Unit Test (Bottom level test): In this category, we test one small piece of functionality in a microservice. 

What is end-to-end Microservices testing?

In this end-to-end testing, we validate every process of the workflow and ensure that the system works together as a whole, and validate all the requirements.

How independent microservices communicate with each other?

It totally depends on the needs of the project. So, microservices communicate with each other using well-known communication styles like single-receiver communication with synchronous HTTP/HTTPS protocols or they can use messaging protocols for asynchronous communication.

Why Microservices use containers? 

A: Containers are the simplest and efficient method to handle all the microservice-based application. Moreover, it assists you to develop and implement separately. Microservice can utilize the containers without extra effort.

What is API Gateway?

API Gateway is an exceptional class of microservices that fulfills the requirement of a single client application. Also, it serves the backend resources i.e. microservices with a single entry point. Hence, there are no more concerns related to monitoring, security, and flexibility. API Gateway uses a client-side load balancer library to spread load all over the instances depending on round-robin fashion. 

What is RESTful? 

RESTful also known as REST (Representational State Transfer) web service is basically an architectural style that assists the computer systems to seamlessly communicate across the Internet. Such web services let it easier to understand and deploy microservices.

What is end-to-end testing Of Microservices?

A: End to End testing authenticates every process within the workflow to make sure everything works flawlessly. Also, it makes sure the system functions in an incorporated manner, and therefore, meeting the business needs. The corresponding tests can encompass the gaps during integration testing or unit testing. Also, it makes sure that the network parameters are properly configured and facilitates the advancement of microservices.

What is the need for reports and dashboards in Microservices?

Reports and dashboards are basically useful for monitoring and maintenance of microservices. Multiple tools are available to accomplish this purpose. 

Reports and dashboards can detect which microservices are allotted with what resources. They can also find out the services that are influenced whenever modifications take place in a component. Moreover, they offer an easy point that can be retrieved whenever documentation is needed. You can use reports and dashboards to gain an understanding of maturity and conformity from the components. In an organization, they are useful to analyze scenarios and ease various kinds of executive tasks.

What is OAuth?

OAuth is the full form of Open-standard Authorization Protocol. It is a framework that depicts how distinct services and servers can safely enable authentic access to their assets. For the same, there is no need to share the interrelated, single login credential. It is possible to share resources saved on one website with another website; no need to use their credentials. OAuth also enables access to the resources from the resource owner. It does so by permitting the client applications on third-party providers like GitHub, Facebook, etc. 

What is Continuous Integration (CI)?

Continuous Integration (CI) is the procedure of making the build and testing for code automatic whenever a team element modifies version control. As a result, it motivates the developers to share code as well as unit tests. The same is done after combining the changes in a shared version control repository and after each small task complete.

What are reactive extensions in Microservices?

Reactive Extensions is a design pattern in which we collect the results by calling the multiple services and then compile a combined response. It is also known as Rx. It works opposite to legacy flows and is very popular in distributed systems.

What is the difference between Monolithic, SOA and Microservices Architecture?

  • Monolithic Architecture is similar to a big container wherein all the software components of an application are assembled together and tightly packaged.
  • Service-Oriented Architecture is a collection of services which communicate with each other. The communication can involve either simple data passing or it could involve two or more services coordinating some activity.
  • Microservice Architecture is an architectural style that structures an application as a collection of small autonomous services, modeled around a business domain.

Whether do you find GraphQL the right fit for designing microservice architecture?

GraphQL and microservices are a perfect fit, because GraphQL hides the fact that you have a microservice architecture from the clients. From a backend perspective, you want to split everything into microservices, but from a frontend perspective, you would like all your data to come from a single API. Using GraphQL is the best way I know of that lets you do both. It lets you split up your backend into microservices, while still providing a single API to all your application, and allowing joins across data from different services.

GraphQL

What are the Disadvantages of Microservices?

  • Communication between services is very complex. In case if your application consists of hundreds or thousands of microservices, then the application becomes really complex. Especially when the services talk to each other.
  • More resources are needed to use multiple services.
  • Debugging is harder.
  • Testing is harder.
  • Cascading of problems to other services.
  • Handling the messages in the queue is very hard.
  • Latency: every call to another service adds some latency and the user has to wait longer until the result comes.
  • Separate deployment of each service

What is Docker?

Docker is an open-source project for automating the deployment of applications as portable, self-sufficient containers that can run on the cloud or on-premises. Docker is also a company that promotes and evolves this technology, working in collaboration with cloud, Linux, and Windows vendors, including Microsoft.

Conclusion

Leave behind your valuable queries and suggestions in the comment section below. Also, if you think this article helps you, do not forget to share this with your developer community. Happy Coding 🙂

Jayant Tripathy
Coder, Blogger, YouTuber

A passionate developer keep focus on learning and working on new technology.

Leave a Reply

Your email address will not be published.