Top 50 Microservices Interview Questions in 2021

Top 50 Microservices Interview Questions in 2021

If you're considering a position in this field, here are some microservices interview questions to expect.


16 min read

Microservices architecture is a method of developing large-scale applications as discrete modules that can function independently but integrate into the overall business application. The use of this service for developing enterprise solutions is increasing. Cloud computing solutions are increasingly in demand due to their simple, modular architecture.

If you're preparing for a job interview in this field, here are microservices interview questions you can anticipate.

Having knowledge of Microservices architecture is crucial. Therefore, beginners in microservices will benefit greatly from the best microservices tutorials.

Microservices Interview Questions

1. What do you understand about Microservices?

Answer: Microservices or, more appropriately, Microservices Architecture is a development approach based on small functional modules for large applications. These functional modules are independently deployable, scalable, target specific business objectives, and communicate via standard protocols. Moreover, these modules can be developed with different programming languages, have their databases, and run anywhere. Here, each module is minimal and complete.

2. What are the main components of Microservices?

Answer: The main components of a Microservice Architecture are:

  • IaC [Infrastructure as Code Conception]
  • Containers, Clustering, and Orchestration
  • API Gateway
  • Cloud Infrastructure
  • Service Delivery
  • Enterprise Service Bus

3. What are the main features of Microservices?

Answer: The following are the main features of microservices:

  • Multiple Individually Deployable Components.
  • Business capability-based distribution of services.
  • Decentralized Data Management.
  • DevOps Implementation.
  • Technical Independence.
  • Avoid unnecessary microservice dependencies with Hidden Component Complexity.

4. What are the fundamental characteristics of a Microservices Design?

Answer: Here are the fundamental characteristics of a Microservices Design:

  • Services are split up and categorized by business functionality.
  • Different development teams handle and own distinct modules.
  • Decentralized Framework.
  • Development teams are responsible for maintaining their respective modules.
  • Different databases may maintain separate modules.
  • Microservice Architectures allow you to deploy modules separately. You can update, enhance, or delete them without disrupting the entire architecture.
  • Keep track of the application in real-time.

5. How does a Microservice Architecture work?

Answer: With a microservice architecture, the application is broken down into independent modules that independently perform the single precise standalone task:

  • They are fragmented into loosely coupled modules that each perform a different function.
  • Cloud-based computing and data centers are both options.
  • Each module should be implemented as an independent service/process that can be replaced, updated, or deleted without affecting the rest of the application.

The microservice architecture allows an application to grow along with its requirements.

6. What are the advantages and disadvantages of Microservices?

Answer: First, let's start with the:


  • Increased Agility
  • Improved Scalability
  • Localized Complexity
  • Fault Isolation
  • Smaller development teams
  • Better scope for technology upgradation.
  • Simplified Debugging & Maintenance
  • Better correspondence between developers and business users.


  • Overall, complicated
  • Deployment Challenges.
  • Accurate Pre-planning is essential.
  • More opportunities for malicious intrusions.
  • Modular dependencies are hard to calculate.
  • Complete end-to-end testing is difficult.
  • Modular Interdependencies are challenging to track.
  • Less control over third party applications

7. What are the main challenges in Microservice Deployment?

Answer: Both technical and functional challenges can arise in Microservices.

Business challenges include:

  • Heavy Infrastructure Setup
  • Require high investment
  • Staff Selection and maintenance.
  • Extensive planning for managing operations overhead

From a technical perspective -

  • Component automation
  • Configuration Management
  • Deployment Challenges
  • Application maintenance
  • Testing and Debugging Challenges
  • Heavy Operations Overhead
  • Communication within different microservices in the application.

8. What is Domain Driven Design?

Answer: Domain-Driven Design is an architectural style based on Object-Oriented Analysis Design concepts and principles. It helps create complex systems by connecting the various components of a software system to a gradually evolving system. Domain-Driven Design relies on three core principles:

  • Focus on the core domain and domain logic.
  • Base complex designs on models of the domain.
  • Collaborate regularly with domain experts to improve application models and resolve any domain-related issues that arise.

9. What are the different strategies of Microservices Deployment?


  • Service Instance per Host: Run a service instance per host.
  • Service Instance per Container: Run each service instance within its own container.
  • Multiple Service Instance per Host: Runs one or more instances of the application on single/multiple physical/virtual hosts.
  • Serverless Deployment: Package the service as a ZIP file and upload it to the Lambda function. Lambda is a stateless function that runs enough microservices to handle all requests.

10. What is the Spring Boot?

Answer: Spring boot is a popular topic in microservices interview questions. With the new functionalities added to Spring, it became more complex. It is mandatory to add a new build path or Maven dependencies whenever you start a new project. To put it simply, you will be starting from scratch. Spring Boot is the solution that will enable you to avoid all the coding configurations.

When answering this common microservices interview question, it is better to give an example from real life. You can think of Spring as the ingredients you would use in cooking. Meanwhile, Spring Boot is an entirely cooked recipe.

11. How do you override a Spring Boot Project’s Default Properties?

Answer: Define the properties in the application .properties.

You must specify the suffix and the prefix for Spring MVC applications. To do this, follow these steps:

  • For suffix – spring.mvc.view.suffix: .jsp
  • For prefix – spring.mvc.view.prefix: /WEB-INF/

12. What problems does Spring Cloud solve?

Answer: The following problems can be solved with spring cloud:

  • With distributed systems, one encounters network problems, overhead issues, bandwidth issues, security problems, and more.
  • Redundancy issues that arise in distributed systems.
  • Distributing load evenly between network links, CPUs, clusters, etc.
  • Performance issues arising from operational overheads.
  • Ensure smooth communication between services in a cluster by resolving service discovery issues.

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


  • Monolithic Architecture: In Monolithic architecture, different components of an application such as UI, business logic, data access layer are integrated into a single platform or program.

  • SOA (Service Oriented Architecture): Each component is loosely coupled and performs a distinct function in SOA. It consists of two roles– service provider and service consumer. Modules in SOAs can be integrated and reused, making them flexible and reliable. It focuses on business priorities and capabilities, i.e., each component of the app can be built independently of the others.

  • Microservices Architecture: This is a type of SOA in which multiple autonomous components are combined to create an application of some kind. APIs are used to integrate these components. It focuses on business priorities and capabilities, i.e., each component of the app can be built independently of the others.

14. Difference between Cohesion and Coupling?

Answer: The difference between Cohesion and Coupling is:

Coupling: The relationship between module A and another module B. Modules can be highly coupled (highly dependent), loosely coupled, and uncoupled from each other. Loose coupling achieved through interfaces is the best coupling.

Cohesion: It is the relationship between two or more parts within a module. A module with high cohesion is capable of performing a specific task efficiently on its own, without relying on other modules. Modules with high cohesion are more functionally strong.

15. Explain end-to-end Microservices Testing?

Answer: This is a technique used to test the entire flow of an application using a business transaction. Because there are several components in a microservices architecture, these tests can cover the gaps during a unit or integration test. Furthermore, it gives end-to-end assurance, ensures that the network parameters are configured correctly, and facilitates the evolution of microservices.

16. What is Distributed Transaction?

Answer: In a distribution transaction, more than one network host is engaged. Transactions are handled by an entity called a transaction manager, which develops and manages transactions. When more than one peer is involved in the transaction, the transaction managers of the peers communicate using the subordinate or superior relationship.

On a similar note, the resource manager also coordinates with the distributed transaction coordinator to ensure transaction atomicity and isolation.

17. How do you implement a Spring Security in a Spring Boot Application?

Answer: To implement a Spring Security in a Spring Boot application, follow these steps:

  • First, add the spring-boot-starter-security in the file pom.xml.
  • Create a Spring config class that overrides the required method while extending the WebSecurityConfigurerAdapter to ensure security in the application.

18. What is Mike Cohn’s Test Pyramid?

Answer: All levels of testing can be automated using the pyramid, including unit testing, service level testing, and UI testing. The pyramid shows that while unit tests are faster and more isolated, UI tests, which are at the highest level, take time and concentrate on integration.

19. What is Spring Cloud?

Answer: In Microservices, Spring Cloud is a system that offers integration with external systems. It is a short-lived framework designed to build applications quickly. With a finite amount of data processing, it plays a crucial role in a microservice architecture.

20. What are the features of Spring Cloud?

Answer: With Spring cloud, you obtain out-of-the-box features and a set of extensive features as follows:

  • Routing
  • Service to service calls
  • Versioned and distributed configuration
  • Global locks and distributed messaging
  • Cluster state and leadership election
  • Discovery of the service registration
  • Circuit breakers and load balancing

21. What is an Actuator?

Answer: Actuators bring production-ready features to an application. The purpose of the actuator is to display operational information about the running application, such as health, metrics, info, dump, environment, etc. A JMX bean or HTTP endpoint is required to interact with it.

22. What is a Container?

Answer: Containers are isolated workload environments within a virtualized operating system. It consists of an application and all the components and files required to run it. Because each box is independent and not tied to any particular software in a physical environment, it provides a solution for application portability.

23. What is PACT in Microservices Architecture?

Answer: The PACT is the contract between a provider application and a consumer application. Pacts are composed of interactions. It is an open-source tool that can be used for implementing Consumer-Driven Contracts in Microservices.

24. What are Coupling and Cohesion?

Answer: In a microservice architecture, Coupling is the strength of dependencies between services. Cohesion refers to the logic that links two or more services together. The entire concept of microservices is based on the ability to deploy and update services while keeping their dependencies intact. Thus, loose coupling and high cohesion are imperative aspects of microservice design.

25. What is Contract Testing?

Answer: In a microservice architecture, contract testing ensures that both explicit and implicit contracts function as expected. Contract to test has two perspectives - consumer and provider. The consumer is the [application] entity using the microservice, and the provider is the [application] entity offering the service. Services of this type follow predefined specifications, and contract testing ensures this.

26. How will you configure Spring Boot Application Login?

Answer: Spring Boot Application Login can be configured by specifying the logging. level in the application. properties file. Usually, it is pre-configured as a console output.

27. What is OAuth?

Answer: In short, OAuth refers to an open-standard authorization protocol or framework that describes how unrelated servers and services can authenticate user access to their assets without sharing a single login credential. It's also known as secure, third-party, user-agent, delegated authorization.

28. What are the steps in End-to-End Microservices Testing?

Answer: Performing end-to-end testing on a microservice application ensures that all processes in the form run smoothly. As a result, we can assume that the system is working well as a whole. Because the microservices application consists of multiple modules orchestrated dynamically, an end-to-end test covers all gaps between the services. End-to-end microservices testing consists of the following steps:

  • Automated Testing
  • Define what you expect from E2E testing.
  • Define the scope of the system to be tested.
  • Test Asynchronous flows
  • Perform authentication in a test environment.
  • Select a testing framework that addresses most of the issues.

29. What can you derive/understand from Conway’s Law?

Answer: Melvin Conway first proposed this idea in the late 1960s. Conway's Law states that "Any organization that designs a system (defined more broadly here than just information systems) will inevitably produce a design whose structure is a copy of the organizations' communication structure." Practically speaking, the team of people who design a piece of software will make the design from their perspective.

30. What is the difference between Mock & Stub?

Answer: As the name implies, Mock is a dummy object initially set up with certain features. Its behavior mainly depends on these features, which then undergo testing.

An object that helps run the test is a Stub. Certain conditions make it function fixedly. The hard-coded behavior allows the stub to run the test.

31. What is Canary Releasing?

Answer: Canary releasing is a technique by which new software versions are introduced by rolling them out to a small subset of users before distributing them to the entire infrastructure and making them available to all users. It is called the Canary release because the technique is modeled after canary releases in coal mines, which warn miners when toxic gases reach dangerous levels.

32. What can we derive from Mike Cohn’s Test Pyramid?

Answer: Cohn's Test Pyramid describes the types of automated tests needed for software development. The Test Pyramid is merely a metaphor that connotes a grouping of tests according to their granularity. This pyramid illustrates what kind of tests are appropriate for different levels of the pyramid.

The Mike Cohn test pyramid consists of three layers that a test suite should include:

  • Unit Testing
  • Service Testing
  • User Interface Testing

Cohn's pyramid yields two conclusions:

  • Define tests with different granularity.
  • The higher your level, the fewer tests you should have.

33. How does Docker help in Microservices?

Answer: We all know that microservices are self-contained, independent units that perform only one business function so that each one can be considered an application on its own. There are many aspects of an application development environment and an application deployment environment that can vary. The result is deployment problems.

With Docker, the application runs on a static background, so deployment issues do not arise. It is a containerization tool. By deploying thousands of microservices on one server, it reduces overhead. Docker ensures that application microservices run in their environments and are entirely independent of their operating systems.

34. What is a Client Certificate?

Answer: It is a digital certificate that is used by client systems to authenticate requests to a remote server. As a result, it is used in many mutual authentication schemes, providing solid assurances about the requester's identity.

35. What is a CDC [Consumer Driven Contract]?

Answer: Consumer-Driven Contracts are a pattern for evolving services. In this scenario, each consumer has a separate contract with their provider. These contracts are then shared with the service provider, allowing them to gain insight into the obligations they must fulfill for each client.

36. What are the different types of credentials of a two-factor Authentication

Answer: Two-factor authentication can be achieved through several methods, but the basic protocol usually includes logging in with a username and password, followed by receiving a text message or an email confirming one's identity. It is considered one-factor authentication; adding an SMS code on top of already using a static password could constitute two-factor authentication because each method offers an alternate type of identification.

Credentials for two-factor authentication can include:

  • Something you know - A PIN, password, or a pattern
  • Something you have – ID, ATM No., Phone No, or an OTP
  • Something you are – Your Biometrics.

37. What are non-deterministic tests, and how will you eliminate them?

Answer: Non-Deterministic tests are unreliable. Sometimes, such tests succeed and sometimes they fail. In case of failure, they are rerun. There are several ways to eliminate non-determinism from tests:

  • Resource Leaks
  • Remote Services
  • Quarantine
  • Time
  • Isolation
  • Asynchronous

38. What is Eureka in Microservices?

Answer: Alternatively, Eureka is called Netflix Service Discovery Server. It uses Spring Cloud and does not rely heavily on application development.

39. How will you balance the server-side load by utilizing Spring Cloud?

Answer: With Netflix Zuul, server-side load balancing is possible. It is also referred to as a JVM-based router.

40. What Embedded Containers Does Spring Boot Support?

Answer: Undertow, Tomcat, and Jetty servers are embedded in Spring Boot.

Jetty – frequently used in a wide range of projects, Eclipse Jetty can be integrated with frameworks, tools, and clusters.

Tomcat – Apache Tomcat is an open-source implementation of JavaServer pages that works well with embedded systems.

Undertow – Known for its versatility, Undertow uses small, single handlers to develop an efficient web server.

41. What is the role of RESTful APIs in Microservices?

Answer: All of the component services of a microservice must interoperate with one another to complete the business functionality. Each microservice must have an interface. RESTful APIs serve as a logical model for building these interfaces. It is based on the open networking principles of the Internet. Therefore, it is the most critical enabler of microservices.

42. What is Tasklet, and what is a Chunk?

Answer: The Tasklet is a minimal interface that uses a single method to execute. You can use tasklets to perform single tasks like running queries, deleting files, etc. Tasklets are interfaces in Spring Batch that are used to run unique steps before or after a step execution, such as cleaning or setting up resources.

Spring Batch's most common implementation uses a 'Chunk Oriented' processing style. Within a transaction boundary, chunk-oriented processing involves reading data one at a time and creating chunks that will be written out.

43. When will you see fit to use the Netflix Hystrix?

Answer: Hystrix is a library for handling error tolerance and latency. The main function of Hystrix is to isolate access points. Furthermore, it ensures all 3rd Party libraries and services are restricted. Using Hystrix, we can reduce the risk of failures in distributed systems and ensure applications run efficiently.

44. What is Spring Batch Framework?

Answer: Spring Batch is an open-source framework for batch processing - the execution of multiple jobs at once. Spring Batch provides classes and APIs for reading and writing resources, managing transactions, monitoring job statistics, resuming jobs, and partitioning large amounts of data.

45. How will you deploy Exception Handling in Microservices?

Answer: When an exception occurs while processing an HTTP request, you must catch it in your controller or service and return an appropriate ResponseEntity manually. Here are some thumb rules for handling exceptions.

  • You can add @ResponseStatus for exceptions that you write.
  • For all other exceptions, add an @ExceptionHandler method on a @ControllerAdvice class or use an instance of SimpleMappingExceptionResolver.
  • For Controller-specific exceptions, assign @ExceptionHandler methods to your controller.

It is important to note that @ExceptionHandler methods on the controller are always selected before those on any @ControllerAdvice instance. ControllerAdvices are processed in an undefined order.

46. How do independent Microservices communicate with each other?

Answer: Microservices can communicate with each other via:

  • Websockets for streaming.
  • Brokers or Server Programs running Advanced Routing Algorithms.
  • HTTP for traditional Request-Response.

It is possible to use message brokers such as RabbitMQ, Nats, Kafka, etc., which each have their specific message semantics. Using an automated backend service like Space Cloud is another option.

47. What do you understand by Idempotence, and how is it used?

Answer: Idempotence describes the repeated performance of the same task with the same result. When it receives commands more than once, it only processes them once, most commonly used as a data source or a remote service.

48. How do you create State Machines out of Microservices?

Answer: Microservices that own their database are independent deployable programs. With this capability, we can create State Machines that specify different states and events for a particular microservice.

49. Where is the WebMVC Test Annotation used?

Answer: Spring MVC Applications are unit tested using WebMvcTest Annotation, its objective being to test Spring MVC components.

Ex: @WebMvcTest(value = ToTestController.class, secure = false)

In the above example, the ToTestController is intended for launch. When this unit test is run, all other controllers and mappings will not be launched.

50. What Is Semantic Monitoring?

Answer: Semantic monitoring combines monitoring of the entire application along with automated tests. Semantic Monitoring is primarily intended to identify factors that are more profitable for your business.

Using semantic monitoring and service layer monitoring, businesses can monitor microservices from a business perspective. As soon as an issue is detected, they enable faster isolation and bug triaging, thereby reducing repair time. The service layer and transaction are triaged to determine if any transactions are affected by poor performance or availability.

Did you find this article valuable?

Support Yash Tiwari by becoming a sponsor. Any amount is appreciated!