List down the advantages of Microservices Architecture.
Advantages of Microservices Architecture
Q2. What do you know about Microservices?
- Microservices, aka Microservice Architecture, is an architectural style that structures an application as a collection of small autonomous services, modeled around a business domain.
- In layman terms, you must have seen how bees build their honeycomb by aligning hexagonal wax cells.
- They initially start with a small section using various materials and continue to build a large beehive out of it.
- These cells form a pattern resulting in a strong structure which holds together a particular section of the beehive.
- Here, each cell is independent of the other but it is also correlated with the other cells.
- This means that damage to one cell does not damage the other cells, so, bees can reconstruct these cells without impacting the complete beehive.

Fig 1: Beehive Representation of Microservices – Microservices Interview Questions
Refer to the above diagram. Here, each hexagonal shape represents an individual service component. Similar to the working of bees, each agile team builds an individual service component with the available frameworks and the chosen technology stack. Just as in a beehive, each service component forms a strong microservice architecture to provide better scalability. Also, issues with each service component can be handled individually by the agile team with no or minimal impact on the entire application.
Q3. What are the features of Microservices?

Fig 3: Features of Microservices – Microservices Interview Questions
- Decoupling – Services within a system are largely decoupled. So the application as a whole can be easily built, altered, and scaled
- Componentization – Microservices are treated as independent components that can be easily replaced and upgraded
- Business Capabilities – Microservices are very simple and focus on a single capability
- Autonomy – Developers and teams can work independently of each other, thus increasing speed
- Continous Delivery – Allows frequent releases of software, through systematic automation of software creation, testing, and approval
- Responsibility – Microservices do not focus on applications as projects. Instead, they treat applications as products for which they are responsible
- Decentralized Governance – The focus is on using the right tool for the right job. That means there is no standardized pattern or any technology pattern. Developers have the freedom to choose the best useful tools to solve their problems
- Agility – Microservices support agile development. Any new feature can be quickly developed and discarded again
Q4. What are the best practices to design Microservices?
The following are the best practices to design microservices:

Fig 4: Best Practices to Design Microservices – Microservices Interview Questions
Q5. How does Microservice Architecture work?
A microservice architecture has the following components:

Fig 5: Architecture of Microservices – Microservices Interview Questions
- Clients – Different users from various devices send requests.
- Identity Providers – Authenticates user or clients identities and issues security tokens.
- API Gateway – Handles client requests.
- Static Content – Houses all the content of the system.
- Management – Balances services on nodes and identifies failures.
- Service Discovery – A guide to find the route of communication between microservices.
- Content Delivery Networks – Distributed network of proxy servers and their data centers.
- Remote Service – Enables the remote access information that resides on a network of IT devices.
Q6. What are the pros and cons of Microservice Architecture?
Q7. What is the difference between Monolithic, SOA and Microservices Architecture?

Fig 6: Comparison Between Monolithic SOA & Microservices – Microservices Interview Questions
- Monolithic Architecture is similar to a big container wherein all the software components of an application are assembled together and tightly packaged.
- A 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.
Q8. What are the challenges you face while working Microservice Architectures?
Developing a number of smaller microservices sounds easy, but the challenges often faced while developing them are as follows.
- Automate the Components: Difficult to automate because there are a number of smaller components. So for each component, we have to follow the stages of Build, Deploy and, Monitor.
- Perceptibility: Maintaining a large number of components together becomes difficult to deploy, maintain, monitor and identify problems. It requires great perceptibility around all the components.
- Configuration Management: Maintaining the configurations for the components across the various environments becomes tough sometimes.
- Debugging: Difficult to find out each and every service for an error. It is essential to maintain centralized logging and dashboards to debug problems.
Q9. What are the key differences between SOA and Microservices Architecture?
The key differences between SOA and microservices are as follows:
Q10. What are the characteristics of Microservices?
You can list down the characteristics of microservices as follows:

Fig 7: Characteristics of Microservices – Microservices Interview Questions
You may go through this recording of Microservices Interview Questions and Answers where our instructor has explained the topics in a detailed manner with examples that will help you to understand this concept better.
Q11. What is Domain Driven Design?

Fig 8: Principles of DDD – Microservices Interview Questions
Q12. Why there is a need for Domain Driven Design (DDD)?

Fig 9: Factors Why we need DDD – Microservices Interview Questions
Q13. What is Ubiquitous language?
If you have to define the Ubiquitous Language (UL), then it is a common language used by developers and users of a specific domain through which the domain can be explained easily.
The ubiquitous language has to be crystal clear so that it brings all the team members on the same page and also translates in such a way that a machine can understand.
Microservices Certification Training
The degree to which the elements inside a module belong together is said to be cohesion.
Q15. What is Coupling?
The measure of the strength of the dependencies between components is said to be coupling. A good design is always said to have High Cohesion and Low Coupling.
Q16. What is REST/RESTful and what are its uses?
Representational State Transfer (REST)/RESTful web services are an architectural style to help computer systems communicate over the internet. This makes microservices easier to understand and implement.
Microservices can be implemented with or without RESTful APIs, but it’s always easier to build loosely coupled microservices using RESTful APIs.
Q17. What do you know about Spring Boot?
It’s a knows fact that spring has become more and more complex as new functionalities have been added. If you have to start a new spring project, then you have to add build path or add maven dependencies, configure application server, add spring configuration. So everything has to be done from scratch.
Spring Boot is the solution to this problem. Using spring boot you can avoid all the boilerplate code and configurations. So basically consider yourself as if you’re baking a cake spring is like the ingredients that are required to make the cake and spring boot is the complete cake in your hand.

Fig 10: Factors of Spring Boot – Microservices Interview Questions
Q18. What is an actuator in Spring boot?
Spring Boot actuator provides restful web services to access the current state of running an application in the production environment. With the help of actuator, you can check various metrics and monitor your application.
Q19. What is Spring Cloud?
According to the official website of Spring Cloud, Spring Cloud provides tools for developers to quickly build some of the common patterns in distributed systems (e.g. configuration management, service discovery, circuit breakers, intelligent routing, leadership election, distributed sessions, cluster state).
Q20. What problems are solved by Spring Cloud?
While developing distributed microservices with Spring Boot we face few issues which are solved by Spring Cloud.
- The complexity associated with distributed systems – This includes network issues, Latency overhead, Bandwidth issues, security issues.
- Ability to handle Service Discovery – Service discovery allows processes and services in a cluster to find each other and communicate.
- Solved redundancy issues – Redundancy issues often occur in distributed systems.
- Load balancing – Improves the distribution of workloads across multiple computing resources, such as a computer cluster, network links, central processing units.
- Reduces performance issues – Reduces performance issues due to various operational overheads.
Q21. What is the use of WebMvcTest annotation in Spring MVC applications?
WebMvcTest annotation is used for unit testing Spring MVC Applications in cases where the test objective is to just focus on Spring MVC Components. In the snapshot shown above, we want to launch only the ToTestController. All other controllers and mappings will not be launched when this unit test is executed.
Q22. Can you give a gist about Rest and Microservices?
REST
Though you can implement microservices in multiple ways, REST over HTTP is a way to implement Microservices. REST is also used in other applications such as web apps, API design, and MVC applications to serve business data.
Microservices
Microservices is an architecture wherein all the components of the system are put into individual components, which can be built, deployed, and scaled individually. There are certain principles and best practices of Microservices that help in building a resilient application.
In a nutshell, you can say that REST is a medium to build Microservices.
Q23. What are different types of Tests for Microservices?
While working with microservices, testing becomes quite complex as there are multiple microservices working together. So, tests are divided into different levels.
- At the bottom level, we have technology-facing tests like- unit tests and performance tests. These are completely automated.
- At the middle level, we have tests for exploratory testing like the stress tests and usability tests.
- At the top level, we have acceptance tests that are few in number. These acceptance tests help stakeholders in understanding and verifying software features.
Q24. What do you understand by Distributed Transaction?
Distributed Transaction is any situation where a single event results in the mutation of two or more separate sources of data which cannot be committed atomically. In the world of microservices, it becomes even more complex as each service is a unit of work and most of the time multiple services have to work together to make a business successful.
Q25. What is an Idempotence and where it is used?
Idempotence is the property of being able to do something twice in such a way that the end result will remain the same i.e. as if it had been done once only.
Usage: Idempotence is used at the remote service, or data source so that, when it receives the instruction more than once, it only processes the instruction once.
Q26. What is Bounded Context?
Bounded Context is a central pattern in Domain-Driven Design. It is the focus of DDD’s strategic design section which is all about dealing with large models and teams. DDD deals with large models by dividing them into different Bounded Contexts and being explicit about their inter-relationships.
Q27. What is Two Factor Authentication?
Two-factor authentication enables the second level of authentication to an account log-in process.

Fig11: Representation of Two Factor Authentication – Microservices Interview Questions
So suppose a user has to enter only username and password, then that’s considered a single-factor authentication.
Q28. What are the types of credentials of Two Factor Authentication?
The three types of credentials are:

Fig 12: Types of Credentials of Two Factor Authentication – Microservices Interview Questions
Q29. What are Client certificates?
A type of digital certificate that is used by client systems to make authenticated requests to a remote server is known as the client certificate. Client certificates play a very important role in many mutual authentication designs, providing strong assurances of a requester’s identity.
Q30. What is the use of PACT in Microservices architecture?
PACT is an open source tool to allow testing interactions between service providers and consumers in isolation against the contract made so that the reliability of Microservices integration increases.
Next
Usage in Microservices:
- Used to implement Consumer Driven Contract in Microservices.
- Tests the consumer-driven contracts between consumer and provider of a Microservice.
Q31. What is OAuth?
OAuth stands for open authorization protocol. This allows accessing the resources of the resource owner by enabling the client applications on HTTP services such as third-party providers Facebook, GitHub, etc. So with this, you can share resources stored on one site with another site without using their credentials.
Q32. What is Conway’s law?
“Any organization that designs a system (defined broadly) will produce a design whose structure is a copy of the organization’s communication structure.” – Mel Conway

Fig 13: Representation of Conway’s Law – Microservices Interview Questions
This law basically tries to convey the fact that, in order for a software module to function, the complete team should communicate well. Therefore the structure of a system reflects the social boundaries of the organization(s) that produced it.
Q33. What do you understand by Contract Testing?
According to Martin Flower, contract test is a test at the boundary of an external service which verifies that it meets the contract expected by a consuming service.
Also, contract testing does not test the behavior of the service in depth. Rather, it tests that the inputs & outputs of service calls contain required attributes and the response latency, throughput is within allowed limits.
Q34. What is End to End Microservices Testing?
End-to-end testing validates each and every process in the workflow is functioning properly. This ensures that the system works together as a whole and satisfies all requirements.
In layman terms, you can say that end to end testing is a kind of tests where everything is tested after a particular period.

Fig 14: Hierarchy of Tests – Microservices Interview Questions
Q35. What is the use of Container in Microservices?
Containers are a good way to manage microservice based application to develop and deploy them individually. You can encapsulate your microservice in a container image along with its dependencies, which then can be used to roll on-demand instances of microservice without any additional efforts required.

Fig 15: Representation of Containers and How they are used in Microservices – Microservices Interview Questions
Q36. What is DRY in Microservices architecture?
DRY stands for Don’t Repeat Yourself. It basically promotes the concept of reusing the code. This results in developing and sharing the libraries which in turn result in tight coupling.
Q37. What is a Consumer-Driven Contract (CDC)?
This is basically a pattern for developing Microservices so that they can be used by external systems. When we work on microservices, there is a particular provider who builds it and there are one or more consumers who use Microservice.
Generally, providers specify the interfaces in an XML document. But in Consumer Driven Contract, each consumer of service conveys the interface expected from the Provider.
Q38. What is the role of Web, RESTful APIs in Microservices?
A microservice architecture is based on a concept wherein all its services should be able to interact with each other to build a business functionality. So, to achieve this, each microservice must have an interface. This makes the web API a very important enabler of microservices. Being based on the open networking principles of the Web, RESTful APIs provide the most logical model for building interfaces between the various components of a microservice architecture.
Q39. What do you understand by Semantic monitoring in Microservices architecture?
Semantic monitoring, also known as synthetic monitoring combines automated tests with monitoring the application in order to detect business failing factors.
Q40. How can we perform Cross-Functional testing?
Cross-functional testing is a verification of non-functional requirements, i.e. those requirements which cannot be implemented like a normal feature.
Q41. How can we eradicate non-determinism in tests?
Non-Deterministic Tests (NDT) are basically unreliable tests. So, sometimes it may happen that they pass and obviously sometimes they may also fail. As and when they fail, they are made to re-run to pass.
Some ways to remove non-determinism from tests are as follows:
- Quarantine
- Asynchronous
- Remote Services
- Isolation
- Time
- Resource leaks
Q42. What is the difference between Mock or Stub?
Stub
- A dummy object that helps in running the test.
- Provides fixed behavior under certain conditions which can be hard-coded.
- Any other behavior of the stub is never tested.
For example, for an empty stack, you can create a stub that just returns true for empty() method. So, this does not care whether there is an element in the stack or not.
Mock
- A dummy object in which certain properties are set initially.
- The behavior of this object depends on the set properties.
- The object’s behavior can also be tested.
For example, for a Customer object, you can mock it by setting name and age. You can set age as 12 and then test for isAdult() method that will return true for age greater than 18. So, your Mock Customer object works for the specified condition.
Q43. What do you know about Mike Cohn’s Test Pyramid?
Mike Cohn provided a model called Test Pyramid. This describes the kind of automated tests required for software development.

Fig 16: Mike Cohn’s Test Pyramid – Microservices Interview Questions
As per pyramid, the number of tests at first layer should be highest. At service layer, the number of tests should be less than at the unit test level, but more than at the end-to-end level.
Q44. What is the purpose of Docker?
Docker provides a container environment that can be used to host any application. In this, the software application and the dependencies which support it are tightly-packaged together.
So, this packaged product is called a Container and since it is done by Docker, it is called Docker container!
Q45. What is Canary Releasing?
Canary Releasing is a technique to reduce the risk of introducing a new software version in production. This is done by slowly rolling out the change to a small subset of users before giving it out to the entire infrastructure, i.e. making it available to everybody.
Q46. What do you mean by Continuous Integration (CI)?
Continuous Integration (CI) is the process of automating the build and testing of code every time a team member commits changes to version control. This encourages developers to share code and unit tests by merging the changes into a shared version control repository after every small task completion.
Q47. What is Continuous Monitoring?
Continuous monitoring gets into the depth of monitoring coverage, from in-browser front-end performance metrics, through application performance, and down to host virtualized infrastructure metrics.
Q48. What is the role of an architect in Microservices architecture?
An architect in microservices architecture plays the following roles:
- Decides broad strokes about the layout of the overall software system.
- Helps in deciding the zoning of the components. So, they make sure components are mutually cohesive, but not tightly coupled.
- Code with developers and learn the challenges faced in day-to-day life.
- Make recommendations for certain tools and technologies to the team developing microservices.
- Provide technical governance so that the teams in their technical development follow principles of Microservice.
Q49. Can we create State Machines out of Microservices?
As we know that each Microservice owning its own database is an independently deployable program unit, this, in turn, lets us create a State Machine out of it. So, we can specify different states and events for a particular microservice.
For Example, we can define an Order microservice. An Order can have different states. The transitions of Order states can be independent events in the Order microservice.
Q50. What are Reactive Extensions in Microservices?
Reactive Extensions also are known as Rx. It is a design approach in which we collect results by calling multiple services and then compile a combined response. These calls can be synchronous or asynchronous, blocking or non-blocking. Rx is a very popular tool in distributed systems which works opposite to legacy flows.
1. What Is Spring Cloud?
Probably, the first microservices interview question that you may encounter. Spring Cloud in Microservices, is a system that provides integration with external systems. It is a short-lived framework that builds an application in a fast manner. Being associated with the finite amount of data processing, it plays a very important role in Microservice architecture.
For typical use cases, Spring cloud provides some out of the box experience and a set of extensive features mentioned-below:
- Versioned and distributed configuration
- Discovery of service registration
- Service to service calls
- Routing
- Circuit breakers and load balancing
- Cluster state and leadership election
- Global locks and distributed messaging
2. What Is Spring Boot?
Spring boot is a major topic under the umbrella of microservices interview questions.
With the new functionalities that have been added, Spring got more complex. Whenever you are starting a new project it is mandatory to add a new build path or Maven dependencies. In short, you will need to do everything from scratch. Spring Boot is the solution that will help you to avoid all the code configurations. Explaining by a real time example is better while answering this common microservices interview question. If you are cooking a dish, the ingredients can be considered to be Spring. While Spring Boot is the completely cooked recipe.
3. How Do You Override A Spring Boot Project’s Default Properties?
This can be done by specifying the properties in application.properties.
For example – In Spring MVC applications, you have to specify the suffix and prefix. This can be done by entering the properties mentioned below in application.properties.
For suffix – spring.mvc.view.suffix: .jsp
For prefix – spring.mvc.view.prefix: /WEB-INF/
4. Role Of Actuator In Spring Boot
It is one of the most important features, which helps you to access the current state of an application that is running in production environment. There are multiple metrics which can be used to check the current state. They also provide endpoints of restful web services which can be simply used to check the different metrics.
5. How Is Spring Security Implemented In A Spring Boot Application?
Minimal configuration is needed for implementation. All you need to do is, add spring-boot-starter-security starter in the file pom.xml. You will also need to create a Spring config class that will override the required method while extending the WebSecurityConfigurerAdapter to achieve security in the application. Here is an example code for the same:
6. Which Embedded Containers Are Supported By Spring Boot?
Whenever you are creating a Java Application, deployment can be done by 2 methods:
- By using an application container that is external
- You can also embed the container inside your jar file.
Spring Boot contains Jetty, Tomcat and undertow servers, all of which are embedded.
Jetty – Used in a wide number of projects, Eclipse Jetty can be embedded in frameworks and application servers, tools as well as clusters.
Tomcat – Apache Tomcat is an open source JavaServer pages implementation which works well with embedded systems.
Undertow – A flexible and prominent web server that uses small single handlers to develop a web server.
7. What Do You Mean By End-To-End Testing Of Microservices?
End to End testing validates all the processes in the workflow to check if everything is working properly as expected. It also ensures that the system works in a unified manner, thereby satisfying the business requirement.
8. What Is Semantic Monitoring?
It combines monitoring of the entire application along with automated tests. The primary benefit of Semantic Monitoring is to find out the factors which are more profitable to your business.
Semantic monitoring along with service layer monitoring approaches monitoring of microservices from a business point of view. Once an issue is detected, they allow faster isolation and bug triaging, thereby reducing the main time required to repair. It triages the service layer and transaction to figure out the transactions affected by availability or poor performance.
9. How Can You Set Up Service Discovery?
There are multiple ways to set up service discovery. I’ll choose the one that I think to be most efficient, Eureka by Netflix. It is a hassle-free procedure that does not weigh much on the application. Plus, it supports numerous types of web applications.
Eureka configuration involves 2 steps – Client configuration and server configuration.
Client configuration can be done easily by using the property files. In the classpath, Eureka searches for eureka-client.properties. It also searches for overrides caused by the environment in property files that are environment-specific.
For server configuration, you have to configure the client first. Once that is done, the server fires up a client which is used to find other servers. The Eureka server, by default, uses the Client configuration to find the peer server.
10. Why Would You Opt For Microservices Architecture?
A very common microservices interview question which you should be ready for! There are plenty of pros that are offered by Microservices architecture. Here are a few of them:
- Microservices can adapt easily to other frameworks or technologies.
- Failure of a single process does not affect the entire system.
- Provides support to big enterprises as well as small teams.
- Can be deployed independently and in relatively less time.
11. Why Would You Need Reports & Dashboards In Microservices?
Reports and dashboards are mainly used to monitor and upkeep microservices. There are multiple tools that help to serve this purpose. Reports and dashboards can be used to:
- find out which microservices expose what resources.
- find out the services which are impacted whenever changes in a component occur.
- provide an easy point which can be accessed whenever documentation is required.
- Versions of the components which are deployed.
- To obtain a sense of maturity and compliance from the components.
12. Why Do People Hesitate In Using Microservices?
I have seen many of us fumble over this question. After all, we are appearing for microservices interview question to be hired as a Microservices architect, so acknowledging cons could always be a little tricky. Here is the answer:
- Requires heavy investment – Microservices demand a great deal of collaboration. Since your teams are working independently, they should be able to synchronize well at all times.
- Heavy architecture set up – The system is distributed, the architecture is heavily involved.
- Excessive planning for handling operations overhead – You need to be ready for operations overhead if you are planning to use Microservices architecture.
- Autonomous staff selection – Skilled professionals are needed who can support microservices that are distributed heterogeneously.
13. How Does PACT Work?
PACT is an open source tool. It helps in testing the interactions between consumers and service providers. However, it is not included in the contract, increasing the reliability of the application.
The consumer service developer starts by writing a test which defines a mode of interaction with the service provider. The test includes the provider’s state, the request body and the response that is expected. Based on it, PACT creates a stub against which the test is executed. The output is stored in a JSON file.
14. Define Domain Driven Design
The main focus is on the core domain logic. Complex designs are detected based on the domain’s model. Involves collaboration with domain experts constantly to resolve issues related to the domain and improve the model of the application. While answering this microservices interview question, you will also need to mention the core fundamentals of DDD. They are
- DDD focuses mostly on domain logic and the domain itself.
- Complex designs are completely based on the domain’s model.
- To improve the design of the model and fix any emerging issues, DDD constantly works in collaboration with domain experts.
15. What is Coupling and Cohesion?
The coupling can be considered to be the measurement of strength between the dependencies of a component. A good Microservices application design always consists of low coupling and high cohesion.
Following the previous question, often the interviewer will ask about cohesion. It is also another measurement unit. More like a degree to which the elements inside a module remain bonded together.
If you are appearing for microservices interview questions then it is imperative to keep in mind that an important key to design microservices is a composition of low coupling along with high cohesion. When loosely coupled, a service knows very little about other. This keeps the services intact. In high cohesion, it becomes possible to keep all the related logic in a service. Otherwise, the services will try to communicate with each other, impacting the overall performance.
16. What Is OAuth?
Open Authorization Protocol, otherwise known as OAuth, helps to access client applications using third-party protocols like Facebook, GitHub etc via HTTP. You can also share resources between different sites without the requirement of credentials.
OAuth allows the account information of the end user to be used by a third party like Facebook while keeping it secure (without using or exposing the user’s password). It acts more like an intermediary on the user’s behalf while providing a token to the server for accessing the required information.
17. Why Do We Need Containers For Microservices?
To manage a microservice based application, containers are the easiest alternative. It helps the user to individually deploy and develop. You can also use Docker to encapsulate the microservice in the image of a container. Without any additional dependencies or effort, microservices can use these elements.
18. What Are The Ways To Access RESTful Microservices?
This is another one of the frequently asked microservices interview questions is how to access RESTful Microservices? You can do that by 2 methods –
- Using a rest template that is load balanced.
- Using multiple microservices.
19. What Are Some Major Roadblocks For Microservices Testing?
Talking about the cons, here is another one of the microservices interview questions you may be ready for, will be around the challenges faced while testing microservices.
- Tester should have a thorough understanding of all the inbound and outbound processes before he starts writing the test cases for integration testing.
- When independent teams are working on different functionalities, collaboration can prove to be quite a struggling task. It can be tough to find an idle time-window to perform a complete round of regression testing.
- With an increasing number of microservices, the complexity of the system also increases.
- During the transition from monolithic architecture, testers must ensure that there is no disruption between the internal communication among the components.
20. Common Mistakes Made While Transitioning To Microservices
Not only on development, but mistakes also lies on the process side often. And any experienced interviewer will have this under the queue for microservices interview questions. Some of the common mistakes are
- Often the developer fails to outline the current challenges.
- Rewriting the programs that are already existing.
- Responsibilities, timeline, and boundaries not clearly defined.
- Failing to implement and figure out the scope of automation from the very beginning.
21. What Are The Fundamentals Of Microservices Design?
This is probably one of the most frequently asked microservices interview questions. Here is what you need to keep in mind while answering to it:
- Define a scope
- Combine loose coupling with high cohesion
- Create a unique service which will act as an identifying source, much like a unique key in a database table
- Creating the correct API and take special care during integration.
- Restrict access to data and limit it to the required level
- Maintain a smooth flow between requests and response
- Automate most processes to reduce time complexity
- Keep the number of tables to a minimum level to reduce space complexity
- Monitor the architecture constantly and fix any flaw when detected.
- Data stores should be separated for each microservices.
- For each microservices, there should be an isolated build.
- Deploy microservices into containers.
- Servers should be treated as stateless.
You can also follow this article explaining 9 fundamentals to a successful microservice design.
22. Where Do We Use WebMVC Test Annotation?
WebMvcTest is used for unit testing Spring MVC applications. As the name suggests, it focuses entirely on Spring MVC components. For example,@WebMvcTest(value = ToTestController.class, secure = false):
Here, the objective is to launch only ToTestController. Until the unit test has been executed, other mappings and controllers will not be launched.
23. What Do You Mean By Bounded Context?
A central pattern usually seen in domain driven design, Bounded Context is the main focus of the strategic design section of DDD. It is all about a deal with large teams and models.. DDD works with large models by disintegrating them into multiple bounded context. While it does that, it also explains the relationship between them explicitly.
24. What Are The Different Types Of Two-Factor Authentication?
There are 3 types of credentials required for performing a two-factor authentication.
- A thing that you know – like password or pin or screen lock pattern.
- A physical credential that you have – like OTP or phone or an ATM card, in other words, any kind of credential that you have in an external or third-party device.
- Your physical identity – like voice authentication or biometric security like a fingerprint or eye scanner.
25. What Is A Client Certificate?
This is a type of digital certificate usually used by client systems for making a request that is authenticated by a remote server. It plays an important role in authentication designs that are mutual and provides strong assurance of the identity of a requester. However, you should have a fully configured back-end service for authenticating your client certificate.
26. What Did The Law Stated By Melvin Conway Implied?
You may have this one under the interviewer’s checklist for microservices interview questions. Conway’s law stated “organizations which design systems … are constrained to produce designs which are copies of the communication structures of these organizations.”
The interviewer may ask a counter microservices interview question like how is the Melvin Conway Law related to microservices. Well, some loosely coupled APIs form the architecture of microservices. The structure is well suited to how a small team is implementing components which are autonomous. This architecture makes an organization much more flexible in restructuring its work process.
27. How to Configure Spring Boot Application Logging?
Spring Boot comes with added support for Log4J2, Java Util Logging, and Logback. It is usually pre-configured as console output. They can be configured by only specifying logging.level in the application.properties file.
logging.level.spring.framework=Debug
28. How Would You Perform Security Testing of Microservices?
Before answering this microservices interview question, explain to the interviewer that microservices cannot be tested as a whole. You will need to test the pieces independently.There are 3 common procedures
Code scanning – To ensure that any line of code is bug-free and can be replicated.
Flexibility – The security solution should be flexible so that it can be adjusted as per the requirements of the system.
Adaptability – The security protocols should be flexible and updated to cope up with the new threats by hackers or security breaches.
You can also follow this blog explaining the influence of Microservices architecture on security.
29. What is Idempotence and How is it Used?
Idempotence refers to a scenario where you perform a task repetitively but the end result remains constant or similar.
Idempotence is mostly used as a data source or a remote service in a way that when it receives more than one instructions, it processes only one instruction.
That’s all from our side. However, if you are seriously thinking about a technology switch, don’t depend on these microservices interview questions alone. Since experienced interviewers will also ask cross questions to check how much in-depth knowledge you have. Go for courses or online tutorials and study about Microservices in details so that you can answer the questions stated above along with connected questions as well.
Microservices architecture
Microservices architecture is a method of developing a large-scale application in the form of discrete modules that work independently of each other but as a whole account for the entire business application under consideration. Organizations are increasingly adopting this service for developing enterprise solutions. As this operates on simple, modular services, there is now an increasing demand for cloud solutions.
Microservices deployment can be Cloud-Based or On-Premise. It's market spans across Healthcare, Banking, Government, Manufacturing, Retail, IT & Telecommunication, Media & Entertainment, Manufacturing, etc. Its intended audience includes Investors and Consultants, System Integrators, Government Organizations, IT & Technology Solution Providers. To name a few, prominent players in this field of expertise are Cognizant, IBM, Microsoft, Salesforce, and Software AG. The microservices architecture market is expected to take a massive leap by the year 2023.
If you are looking into a career in this field and are getting yourself interview ready, here are a few quick microservices interview questions and answers you can expect.
Microservices Interview Questions and Answers
The questions and answers listed here have been compiled from many resources off the internet. This should not be considered as the ultimate guide for microservices interview. Please acquire in-depth knowledge in this field and consult more books and resource guides for connecting questions in this regard.
Answer: Microservices or more appropriately Microservices Architecture is an SDLC approach based on which large applications are built as a collection of small functional modules. These functional modules are independently deployable, scalable, target specific business goals, and communicate with each other over standard protocols. Such modules can also be implemented using different programming languages, have their databases, and deployed on different software environments. Each module here is minimal and complete.
Question: What are the main features of Microservices?
Answer: Microservices have the following main features:
- Multiple Individually Deployable Components.
- Service Distribution based on Business Capabilities.
- Decentralized Data Management.
- DevOps Implementation.
- Technical Independence.
- Hidden Component Complexity to avoid unnecessary microservices dependencies.

Question: What are the main components of Microservices?
Answer: The main components for a Microservice Architecture are:
- Containers, Clustering, and Orchestration
- IaC [Infrastructure as Code Conception]
- Cloud Infrastructure
- API Gateway
- Enterprise Service Bus
- Service Delivery
Question: How does a Microservice Architecture work?
Answer: Under a microservice architecture, an application is simplified into multiple modules that independently perform the single precise standalone task:
- Are fragmented into loosely coupled various modules, each of which performs a distinct function.
- It can be or are distributed across clouds and data centers.
- Implement each module as an independent service/process which can be replaced, updated, or deleted without disrupting the rest of the application.
Under microservice architecture, an application can grow along with its requirements.
Question: What are the fundamental characteristics of a Microservices Design?
Answer:
- Services split up and organized around business functionality.
- Separate modules handled and owned by different development teams.
- Decentralized Framework.
- Maintenance of respective modules by respective development teams.
- Separate modules may be maintained by different databases.
- Modules in a Microservice Architecture are separately deployable. They can be updated, enhanced, or deleted without disrupting the entire architecture.
- Real-time monitoring of the application.
Question: What are the main challenges in Microservice Deployment?
Answer: The challenges in Microservice can be both technical as well as functional.
From the point of business, the main challenges are:
- Require heavy investment
- Heavy Infrastructure Setup
- Excessive Planning for managing operations overhead
- Staff Selection and maintenance.
From Technical Stand point
- Communication between different microservices in the application.
- Component automation
- Application maintenance
- Configuration Management
- Heavy Operations Overhead
- Deployment Challenges
- Testing and Debugging Challenges
Question: What are the advantages and disadvantages of Microservices?
Answer:
Advantages:
- Improved Scalability
- Fault Isolation
- Localized Complexity
- Increased Agility
- Simplified Debugging & Maintenance
- Better correspondence of developers with business users.
- Smaller development teams
- Better scope for technology upgradation.
Disadvantages:
- Complicated as a whole.
- Requires accurate pre-planning
- Modular dependencies are hard to calculate.
- Less control over third party applications
- Modular Interdependencies are challenging to track.
- More opportunities for malicious intrusions.
- Complete end-to-end testing is difficult.
- Deployment Challenges.
Question: What are the different strategies of Microservices Deployment?
Answer:
- Multiple Service Instance per Host: Run single or multiple service instances of the application on single/multiple physical/virtual hosts.
- Service Instance per Host: Run a service instance per host.
- Service Instance per Container: Run each service instance in its respective container.
- Serverless Deployment: Package the service as a ZIP file and upload it to the Lambda function. The Lambda function is a stateless service that automatically runs enough micro-services to handle all requests.
Question: List the differences between Monolithic, SOA, and Microservices Architecture with an example for each.
Answer:
| In Monolithic Architecture, all software components of the application are assembled and packed tightly. | SOA [Service Oriented Architecture] is a collection of services that communicate with each other through simple data passing or activity coordination. | Microservices Architecture is a collection of small functional modules. These functional modules are independently deployable, scalable, target specific business goals, and communicate with each other over standard protocols. |
Question: What is Domain Driven Design?
Answer: Domain-Driven Design is an architectural style based on Object-Oriented Analysis Design concepts and principles. It helps in developing a complex system by connecting the related components of the software system into a continuously evolving system. Domain-Driven Design is based on three core principles:
- Focus on the core domain and domain logic.
- Base complex designs on models of the domain.
- Regularly collaborate with the domain experts to improve the application model and resolve any emerging domain-related issues.
Question: What is the Spring Boot?
Answer: Spring Boot is an open-sourced, Java-based framework that provides its developers with an excellent platform for developing a stand-alone and production-grade spring application. It is easy to understand, increases productivity, and reduces development time. It automatically configures a claim based on the added dependencies of an application.
Question: How do you override a Spring Boot Project’s Default Properties?
Answer: Specify the properties in application.properties.
Spring MVC applications need the suffix and the prefix to be specified. This can be done by:
- For suffix – spring.mvc.view.suffix: .jsp
- For prefix – spring.mvc.view.prefix: /WEB-INF/
Question: What is the difference between Monolithic, SOA and Microservices Architecture?
Answer:
- Monolithic Architecture: In this type of architecture, different components of an application like UI, business logic, data access layer are combined into a single platform or program.
- SOA (Service Oriented Architecture): In this architecture, individual components are loosely coupled and perform a discrete function. There are two main roles – service provider and service consumer. In SOA type, modules can be integrated and reused, making it flexible and reliable.
- Microservices Architecture: It is a type of SOA in which a series of autonomous components are built and combined to make an app. These components are integrated using APIs. This approach focuses on business priorities and capabilities and offers high agility, i.e. each component of the app can be built independently of the other.
Question: Difference between Cohesion and Coupling?
Answer: Coupling: it is the relationship between module A and another module B. Any module can be highly coupled (highly dependent), loosely coupled and uncoupled with other modules. The best coupling is loose coupling achieved through interfaces.
Cohesion: it is the relationship between 2 or more parts within a module. If a module has high cohesion, it means the module can perform a certain task with utmost efficiency on its own, without communication with other modules. High cohesion enhances the functional strength of a module.
Question: Mention the problems that are solved by Spring Cloud?
Answer: Spring cloud can solve the following problems:
- Network issues, latency overhead, bandwidth issues, security issues and other issues with distributed systems
- Redundancy issues that occur in distributed systems.
- Balancing the distribution of load between resources like network links, CPU, clusters etc.
- Performance issues because of operational overheads.
- Service discovery issues to ensure smooth communication between services in a cluster.
Question: What is Distributed Transaction?
Answer: Distribution transaction has two or more network hosts that are engaged. Transactions are handled by a transaction manager that takes care of developing and handling transactions. If the transaction involves more than one peer, transaction managers of each peer communicate with each other using subordinate or superior relationships.
Same way, resources are handled by the resource manager that also coordinates with the distributed transaction coordinator for transaction atomicity and isolation.
Question: Explain end to end Microservices Testing?
Answer: It is a testing technique used to test the entire flow of an application using a business transaction. Since several components are involved in microservices architecture, these tests can cover the gaps during a unit or integration testing. It also gives end to end confidence, ensures that the network parameters are appropriately configured and helps microservices to evolve.
Question: What is Mike Cohn’s Test Pyramid?
Answer: The pyramid helps maximize automation at all levels of testing, i.e. unit testing, service level testing, UI testing. The pyramid indicates that while unit tests are faster and more isolated, UI tests, which are at the highest level, take time and focus on integration.
Question: How do you implement a Spring Security in a Spring Boot Application?
Answer:
- Add spring-boot-starter-security in the file pom.xml.
- Create a Spring config class that will override the required method while extending the WebSecurityConfigurerAdapter to achieve security in the application.
Question: 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. It is usually pre-configured as console output.
Question: What is Spring Cloud?
Answer: While building a distributed system, there are a few problems that are encountered. They are Configuration Management, Service Discovery, Circuit breakers, and distributed sessions. Spring Boot is a collection of tools that provides solutions to such commonly encountered problems.
Question: What is an Actuator?
Answer: The actuator brings in production-ready features into an application. It is mainly used to expose operational information about the running application’s health, metrics, info, dump, env, etc. It uses HTTP endpoints or JMX beans to interact with it.
Question: What is a Container?
Answer: Containers are isolated workload environments in a virtualized operating system. It consists of an application and all the features and files required to run it. Each box is an independent environment and is not tied to the software on a physical environment, thus providing a solution for application portability.

Question: What are Coupling and Cohesion?
Answer: The strength of dependencies between services in a microservice architecture is said to be coupling. Cohesion refers to the related logic between two or more services. The entire concept of microservices is based on the ability to deploy and update service while keeping other services intact. Hence, loose coupling and high cohesion is the key to a microservice design.
Question: What is PACT in Microservices Architecture?
Answer: A contract between a consumer application and a provider application is called a PACT. Each pact is a collection of interactions. It is an open-source tool that can be used to implement the Consumer-Driven Contract in Microservices.
Question: What is Contract Testing?
Answer: Contract Testing ensures that the explicit and implicit contracts of a microservice architecture work as expected. There are two perspectives to contract to test – Consumer and Provider. The consumer is the [application] entity using the microservice, and the provider is the [application] entity providing the service. Such services work under predefined specifications, and contract testing ensures so.
Question: What is OAuth?
Answer: OAuth stands for Open-standard Authorization Protocol or framework that describes how unrelated servers and services can safely allow authenticated access to their assets without sharing the initial related, single login credential. This is also known as secure, third-party, user-agent, delegated authorization.
Question: What can you derive/understand from Conway’s Law?
Answer: Melvin Conway stated this idea in the late 1960s. This law implies that ‘organizations which design systems are constrained to produce designs which are copies of the communication structures of these organizations.” In simpler words, the team of people who design a piece of software will eventually make the design as per their perspective.
Question: What are the steps in an End-to-End Microservices Testing?
Answer: End-To-End testing of a microservice application ensures that every process in the form is running properly. This validates that the system as a whole is working properly. As the microservices application is built with multiple modules orchestrated dynamically, an end to end testing covers all the gaps between the services.
The steps to an end-to-end microservices testing are:
- Define what you expect from an e2e testing.
- Define the scope of the system to be tested.
- Perform authentication in a test environment.
- Choose a testing framework that addresses most of the issues.
- Test Asynchronous flows
- Automate Testing
Question: What is the difference between Mock & Stub?
Answer: A Mock is generally a dummy object where certain features are set into it initially. Its behavior mainly depends on these features, which are then tested.
A Stub is an object that helps in running the test. It functions in a fixed manner under certain conditions. This hard-coded behavior helps the stub to run the test.
Question: What can we derive from Mike Cohn’s Test Pyramid?
Answer: Mike Cohn’s Test Pyramid describes the type of automated tests required for software development. The Test Pyramid is only a metaphor that implies a grouping of tests based on their granularity. This Pyramid tells which kind of tests should be applied to different levels of the pyramid.
Mike Cohn’s test pyramid consists of three layers that a test suite should consist:
- Unit Testing
- Service Testing
- User Interface Testing.
Two points to be derived from Cohn’s pyramid is that:
- Define tests with different granularity
- The higher in the level you get, the fewer tests you should have.
Question: How does Docker help in Microservices?
Answer: Microservices, as we know, are self-contained, individual units that perform only one business function, so much so that each unit can be considered an application on its own. The application development environment and application deployment environment are bound to vary in many aspects. This gives rise to deployment issues. Docker provides a static background for the application to run, thus avoiding deployment issues. It is, in fact, a containerization tool. It reduces overhead and deploys thousands of microservices on the same server. Docker ensures that an application microservices will run on their own environments and are entirely separate from their operating system.
Question: What is Canary Releasing?
Answer: Canary releasing is a technique by which new software versions are introduced by rolling out the updated version to a small subset of users before rolling it out to the entire infrastructure and making it available to everybody. This technique is so-called because it is based on canary releases in coal mines to alert miners when the toxic gases reach dangerous levels.
Question: What are the different types of credentials of a two-factor Authentication?
Answer: Two-factor authentication calls for a second round of authentication to an account login process. Entering a username – password is a one-factor authentication. Username – Password authentication and then say mobile number or a secret key authentication can be considered as a two - factor authentication.
The different types of credentials for two-factor authentication can be:
- 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.

Question: What is a Client Certificate?
Answer: A Client Certificate is a digital certificate that is used by client systems to make authenticated requests to a remote server. It plays a key role in many mutual authentication designs, providing strong assurances of a requester’s identity.
Question: What is a CDC [Consumer Driven Contract]?
Answer: Consumer-Driven Contracts are patterns for evolving services. Here, each consumer captures their provider in a separate contract. All these contracts are then shared with the provider, which helps them to gain an insight into the obligations they must fulfill for each individual client.
Question: What are non-deterministic tests, and how will you eliminate them?
Answer: NDT or Non-Deterministic are unreliable tests. Such tests sometimes pass and sometimes fail. When these tests fail, they are re-run to give. Non-Determinism from tests can be eliminated in the following ways:
- Quarantine
- Asynchronous
- Remote Services
- Isolation
- Time
- Resource Leaks
Question: What are Reactive Extensions in Microservices?
Answer: Reactive Extensions is a design approach through which results are collected by calling multiple services in order to compile a combined response. Also known as Rx, these calls can be synchronous or asynchronous.
Question: What is the role of RESTful APIs in Microservices?
Answer: A microservice is based on the concept where all it's component services require to interact with one another to complete the business functionality. This requires each microservice to have an interface. RESTful APIs provide a logical model for building these interfaces. It is based on the open networking principles of the Web. Thus, it serves as the most critical enabler of microservices.
Question: What is Eureka in Microservices?
Answer: Eureka is alternatively known as the Netflix Service Discovery Server. It uses Spring Cloud and is not heavy on the application development process.
Question: How will you balance the server-side load by utilizing Spring Cloud?
Answer: The server-side load balancing can be done by using Netflix Zuul. It is also known as a JVM based router.
Question: When will you see fit to use the Netflix Hystrix?
Answer: Hystrix is an error tolerance and latency library. Hystrix mainly isolates the access points. It also makes sure that all 3rd Party libraries and services are restricted. Thus, we can use Hystrix to ensure that an application runs efficiently and avoids the kind of failures that occur in distributed systems.
Question: What is Spring Batch Framework?
Answer: Spring Batch is an open-source framework for batch processing – execution of a series of jobs. Spring Batch provides classes and APIs to read/write resources, transaction management, job processing statistics, job restart, and partitioning techniques to process high volume data.
Question: What is Tasklet, and what is a Chunk?
Answer: The Tasklet is a simple interface with one method to execute. A tasklet can be used to perform single tasks like running queries, deleting files, etc. In Spring Batch, the tasklet is an interface that can be used to perform unique tasks like clean or set up resources before or after any step execution.
Spring Batch uses a ‘Chunk Oriented’ processing style within its most common implementation. Chunk Oriented Processing refers to reading the data one at a time and creating chunks that will be written out, within a transaction boundary.
Question: How will you deploy Exception Handling in Microservices?
Answer: If an exception occurs while processing an HTTP request, you need to catch the exception in your controller or service and return an appropriate ResponseEntity manually. Here are some thumb rules for exception handling.
- Add @ResponseStatus for exceptions that you write.
- For all other exceptions, implement an @ExceptionHandler method on a @ControllerAdvice class or use an instance of SimpleMappingExceptionResolver.
- For Controller specific exceptions, add @ExceptionHandler methods to your controller.
Point to be noted is that @ExceptionHandler methods on the controller are always selected before those on any @ControllerAdvice instance. It is undefined in what order ControllerAdvices are processed.
Question: How can you access RESTful Microservices?
Answer: Considering the microservice architecture concept, each microservice needs to have an interface. Based on the principles of open networking of the Web, RESTful APIs provide the most logical model for building interfaces between the various components of the microservices architecture. RESTful APIs can be accessed in two ways:
- Using a REST Template that is load balanced.
- I am using multiple microservices.
Question: How do independent Microservices communicate with each other?
Answer: Microservices can communicate with each other through:
- HTTP for traditional Request-Response.
- Websockets for streaming.
- Brokers or Server Programs running Advanced Routing Algorithms.
For message brokers, RabbitMQ, Nats, Kafka, etc., can be used, each built for a particular message semantic. Another way is to use Backend As A Service like Space Cloud, which automates the entire backend.
Question: What is Semantic Monitoring?
Answer: Semantic Monitoring or Synthetic Monitoring is running a subset of the application’s automated tests against the live production system. These results are monitored, and alerts are generated in case of failures. Semantic Monitoring approaches microservice monitoring from the business transaction perspective. Instead of monitoring each component, its semantic monitoring ascertains how well the transaction performs for business and the users. It also detects the faulty service layer and the corresponding microservice instance, all at the same flow. This approach allows for faster triaging and reduces the meantime to repair.
Question: How do you perform security testing of Microservices?
Answer: Microservices Application is a collection of smaller, independent, functional modules that may be developed in different programming languages, have different data sources, and run on different operating systems. This makes testing of the microservices as a whole a very tough task. The different pieces/modules need to be tested independently. There are three common procedures for this.
- Code Scanning: In order to ensure that every line of code is bug-free and can be replicated.
- Flexibility: The security protocols should be flexible as per the requirements of the system.
- Adaptability: The security protocols should be adaptable to the malicious intrusions.
Question: What do you understand by Idempotence, and how is it used?
Answer: Idempotence refers to the repeated performing of a task even though the end result remains the same. It is used mostly as a data source or a remote service in a way that when it receives the instruction more than once, it processes the instruction only once.
Question: What are the uses of Reports and Dashboards in Microservices environments?
Answer: Reports and Dashboards are generally used to monitor a system. For microservices Reports and Dashboards help to:
- Find which microservice support which resource.
- Find out the services that are impacted whenever changes in components are made/occur.
- Provide an easy point of access for documentation purposes.
- Review versions of the deployed components.
- Obtain compliance from the components.
Question: What are the tools that can be considered for managing a microservice architecture?
Answer: The main tools that can be used to build/manage a microservice architecture are:
- MongoDB: It is a document-based open-source distributed database. Here data is stored in JSON format with a different structure for different documents. It also supports a lot of programming languages like C, C++, C#, PERL, PHP, Python, Java, Ruby, Scala, etc.
- Elasticsearch: It is a full-text search engine.
- KAFKA: It is an event queue system. All transactions are processed via the event queue, thus avoiding the web like random interactions between different services. Kafka renders a microservice architecture robust and clean.
- JENKINS: It is an automation tool that enables Continuous Integration and Continuous Development. It supports many plugins and easily integrates with almost every tool.
- DOCKER: The application development environment and application deployment environment are bound to vary in many aspects. This gives rise to deployment issues. Docker provides a static background for the application to run, thus avoiding deployment issues.
- KUBERNETES: With thousands of services running in an application, Kubernetes, as an engine orchestrates the entire process.
- JAEGER: It is an open-source end to end distributed tracing tool. Jaeger monitors distributed transactions, helps in performance optimization, and finds the dependencies between services. It also gives the root cause analysis.
- FLUENT: In a multiservice architecture, where all the different systems are managed via different programming languages, different databases, and run in different operating systems, logging in, and keeping track of it is a significant issue. Fluentd provides a single logging layer and simplifies this issue. Logs can be also be collected and aggregated onto a data source.
- PROMETHEUS: It is a monitoring tool, which helps to check if all services are working fine when the application is deployed. It is a time-series data store. It collects metrics from an application and displays it in a graphical format.
- grafana: Grafana provides analytics and monitoring into different visualization formats like graphs, charts, tables, etc.
- NGINX: It acts as a reverse proxy. It acts as a single point entry through which all the API calls are made.
Question: How do you create State Machines out of Microservices?
Answer: Each microservice owning its database is an independently deployable program. This enables the creation of State Machines by which we can specify different states and events for a particular microservice.
Question: What are the most common mistakes while transitioning to Microservices?
Answer:
- Failure to outline the main challenges.
- I am rewriting already existing programs.
- Vague definitions of responsibilities, timeline, and boundaries.
- Failure to identify and implement automation.
Question: Where is the WebMVC Test Annotation used?
Answer: WebMvcTest Annotation is used for unit testing Spring MVC Applications, where the test objective is to focus on Spring MVC Components.
Ex: @WebMvcTest(value = ToTestController.class, secure = false)
In the above example, the intention is to launch the ToTestController. All other controllers and mappings will not be launched when this unit test is executed.
Question: Give one/a few examples of microservices implementation.
Answer: Netflix, Paypal, Amazon, eBay, Twitter, and many other large-scale websites have started as monolithic and evolved into a microservices architecture.
