Most Asked Microservices Interview Questions
Following is the list of most frequently asked Microservices Interview questions and their best possible answers.
1) What are Microservices? / What do you understand by Microservices?
Microservices are an architectural approach or style that is used to build applications. The microservice architecture provides a rapid, frequent and reliable delivery of large and complex applications. It is distributed and loosely coupled, so it won't break the entire app if you make changes in one team.
Microservices are also known as the microservice architecture, a variant of the service-oriented architecture (SOA) structural style and used to structure an application as a collection of services that have the following features:
2) What are the most significant benefits of using microservices?
The most significant benefit of using microservices is that it builds an application to collect small autonomous services developed for a business domain. So, if the business needs to change constantly, the development teams can rapidly build new apps components to meet the requirement.
Each microservice runs a unique process and communicates through a well-defined, lightweight mechanism, such as a container, to serve a business goal. It also makes an organization capable of evolving its technology stack.
3) What are the three commonly used tools for Microservices?
Following are the three commonly used tools for Microservices:
4) What are the main components of Microservices?
Following is the list of main components of Microservices or Microservice architecture:
5) How does a Microservice architecture work?
The Microservice architecture of an application can be simplified into multiple modules that independently perform the single precise standalone task. Let's see how Microservice architecture works:
6) What are the main advantages of using Microservices?
Following is a list of some most important advantages of using Microservices:
7) What do you understand by Monolithic Architecture?
Monolithic architecture is like a big container that contains all the software components of an application. These applications are clubbed inside a single package within the application.
8) What are the biggest challenges in Microservice deployment?
We can specify the biggest challenges in Microservice deployment in two ways, i.e., technical and functional.
The main challenges from the business point of view:
The main challenges from a technical point of view:
9) What do you understand by Spring Cloud?
Spring cloud is an Integration software used to integrate with external systems. It allows a microservices framework to build applications that perform restricted amounts of data processing.
10) What are the main differences between Microservices and Monolithic Architecture?
The main differences between Microservices and Monolithic Architecture:
11) In which cases microservice architecture is best suited?
The microservice architecture is best suited for all tech devices such as desktop, web, mobile devices, Smart TVs, Wearable devices, etc.
12) What are the most significant advantages and disadvantages of using Microservices?
Following is the list of the most significant advantages and disadvantages of using Microservices:
Advantages of Microservices
Disadvantages of Microservices
13) Which are some famous companies that are using Microservice architecture?
Most large-scale software companies and websites such as Twitter, Netflix, Amazon are using microservices architecture instead of monolithic architecture.
14) What do you understand by RESTful?
REST or RESTful stands for Representational State Transfer. The RESTful web service is an architectural style that helps computer systems to communicate over the internet. These web services make microservices easier to understand and implement.
15) What are the different strategies used in Microservices deployment?
Following strategies are used in Microservices deployment:
16) What are the three types of tests used in Microservices?
We can categorize the tests used in Microservice architecture into three main categories:
17) What is the main difference between SOA and the Microservices Architecture?
SOA stands for Service Oriented Architecture. It is a collection of services used to communicate with each other through simple data passing or activity coordination. On the other hand, the Microservices Architecture is a collection of small functional modules that are independently deployable, scalable, target specific business goals, and communicate over standard protocols.
18) What is a Client certificate? What is its usage?
A client certificate is a digital certificate used to make authenticated requests to a remote server. A certificate is generated for each microservice.
19) What do you understand by Domain-Driven Design?
Domain-Driven Design is an architectural style based on Object-Oriented Analysis Design concepts and principles. It is used to develop a complex system by connecting the related components of the software system into a continuously evolving system. Domain-Driven Design is based on three principles:
20) What is the use of PACT in Microservices architecture?
PACT is an open-source tool used for testing interactions between service providers and consumers. It increases the reliability of the Microservices applications.
21) What do you understand by OAuth?
OAuth stands for Open Authorization protocol. This protocol allows you to access the client applications on HTTP for third-party providers GitHub, Facebook, etc. It also facilitates us to share resources stored on one site with another site without their credentials.
22) What is Spring Boot? Why is it used?
Spring Boot is an open-source, Java-based framework that provides developers an excellent platform for developing a stand-alone and production-grade spring application. It is easy to understand, reduces development time, and increases productivity. It automatically configures a claim based on the added dependencies of an application.
23) What is the method to override a Spring Boot project's default properties?
We can do it by specifying the properties in application.properties. The Spring MVC applications need the suffix and the prefix to be specified. This can be done by:
24) What do you understand by end-to-end Microservices testing?
End-to-end testing is used to validate that every process in the workflow is functioning correctly. It also ensures that the system works together as a whole and fulfills all the requirements.
25) What is the difference between Coupling and Cohesion?
Difference between Coupling and Cohesion
Coupling: Coupling is specified as a relationship between module A and another module B. There are mainly three types of coupling. Any module can be highly coupled (highly dependent), loosely coupled, and uncoupled with other modules. The best coupling is the loose coupling which can be achieved through interfaces.
Cohesion: Cohesion is the relationship between 2 or more parts within a module. The high cohesion within a module specifies that the module can perform a specific task with maximum efficiency on its own, without the need to communicate with other modules. High cohesion increases the functional strength of the module.
26) What is the use of containers in Microservices?
Containers are the easiest and effective method to manage microservice-based applications. They are like a software development platform. They also help us to develop and deploy individually. A Docker is an example of a container. It is an open-source software development platform that allows us to encapsulate our microservice in a container image along with its dependencies. Microservice can use these elements without additional efforts.
27) What is Spring Cloud? What problems can be solved by using Spring Cloud?
Spring Cloud is a collection of tools used by developers to quickly build some of the common patterns in distributed systems such as configuration management, circuit breakers, service discovery, intelligent routing, micro-proxy, control bus, one-time tokens, global locks, leadership election, distributed sessions, cluster state, etc.
We can use spring cloud to solve the following problems:
28) What do you understand by semantic monitoring in Microservices architecture?
Semantic monitoring is used to combine the automated tests by monitoring the application. It is used to find out the reasons why your business is not getting more profits.
29) What do you understand by the Distributed Transaction?
A distribution transaction is a type of transaction that has two or more engaged network hosts. In this transaction, a transaction manager takes care of developing and handling transactions. If the transaction involves more than one peer, the transaction managers of each peer communicate with each other using subordinate or superior relationships. In the same way, the resource manager handles the resources and coordinates with the distributed transaction coordinator for transaction atomicity and isolation.
30) What is the full form of CDC? What is its usage?
The full form of CDC is a Consumer-Driven Contract. It is a pattern used for developing Microservices so that the external systems can use them efficiently.
31) What is Reactive Extension in Microservices?
Reactive Extension is a design pattern that allows collecting results by calling multiple services and then compiles a combined response. It is also called Rx. Rx is a popular tool in distributed systems that works opposite to legacy flows.
32) How can you configure Spring Boot application login?
We can configure the Spring Boot application login by specifying the logging.level in the application.properties file. Generally, it is pre-configured as console output.
33) What do you understand by the term 'Continuous Monitoring'?
The term continuous monitoring is used to specify a method used to search compliance and risk issues associated with a company's operational and financial environment. This method contains human processes and working systems that support efficient and actual operations.
34) What is Mike Cohn's Test Pyramid?
Mike Cohn's Test Pyramid is used to maximize automation at all levels of testing, such as unit testing, service level testing, UI testing, etc. This pyramid specifies that while unit tests are faster and more isolated, UI tests, which are at the highest level, take time and focus on integration.
35) How independent micro-services communicate with each other?
We can make our micro-services communicate with each other according to our project needs. In most cases, developers use HTTP/REST with JSON or Binary protocol while using any communication protocol.
36) How can you implement a Spring Security in a Spring Boot Application?
We can quickly implement a Spring Security in a Spring Boot Application by using the following method:
37) What do you understand by ubiquitous language?
Ubiquitous Language or UL is a common language used by developers and users of a specific domain to explain that domain easily. The ubiquitous language has to bring all the team members on the same page and be translated so that a machine can understand.
38) What is the difference between Rest and Microservices?
There are multiple ways to implement microservices. REST over HTTP is one of them. REST is also used in other applications such as web apps, API design, and MVC applications to serve business data.
On the other hand, in microservices architecture, all the system components are put into individual components, which can be built, deployed, and scaled individually. Microservices provide certain principles and best practices that help in building a resilient application. So, we can say that REST is a medium to build Microservices.
39) What do you understand by Idempotence? Where is it used?
Idempotence is a property that facilitates us to do something twice so that the result will remain the same always in such a way that if it had been done once only. Usage of Idempotence: 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.
40) What is an Actuator in Microservices? Why is it used?
Actuator is a sub-project of Spring Boot. It brings in production-ready features into an application and 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.
41) What is the use of Bounded Context in Domain-Driven Design?
The Bounded Context is a central pattern in Domain-Driven Design. It is the core of Domain-Driven Design's strategic design section, which deals with large models and teams. It is used to divide the large models into different Bounded Contexts and being explicit about their inter-relationships.
42) What is PACT in Microservices Architecture?
The contract between a consumer application and a provider application is known as 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.
43) What do you understand by Two Factor Authentication? What are the different types of credentials used in Two Factor Authentication?
Two-factor authentication enables the users to fulfill the second level of authentication to an account login process. If a user has to enter only a username and password at the time of login, it would be considered a single-factor authentication. But in Two-factor authentication, the user has to enter more information than the login password.
Mainly three types of credentials are used in Two-factor authentication:
44) What is the need for Reports and Dashboards in Microservices?
Reports and dashboards are mainly used to monitor microservices. There are multiple tools used for this purpose.
Following is the list of some usages of Reports and dashboards in microservices:
45) What do you understand by Canary Releasing?
Canary releasing is a technique used to introduce new software versions by rolling out the updated version or new code/features to a subset of users as an initial test before making the entire infrastructure available to everybody. This technique is called canary release because it is based on canary releases in coal mines to alert miners when the toxic gases reach dangerous levels.
46) Why do many developers hesitate in using Microservices? / What are the biggest cons of using Microservices?
There are some cons of Microservices that can make developers hesitate in using Microservices:
47) What are non-deterministic tests? What is the process to eliminate them?
Non-deterministic tests or NDT are unreliable tests that sometimes pass and sometimes fail. When these tests fail, they are re-run again. We can use the following ways to eliminate non-determinism from Non-Deterministic tests.
48) What is the usage of WebMvcTest annotation in Spring MVC applications?
WebMvcTest annotation is used for unit testing in Spring MVC Applications in cases where the test objective is to focus on Spring MVC Components.
See the following code:
@WebMvcTest(value =ToTestController.class, secure = false):
Here, we want to launch only the ToTestController. All other controllers and mappings will not be launched until this unit test is executed.
49) What is Eureka in Microservices?
Eureka or Eureka Server is an application that holds the information about the client-service applications. Microservices have to register into the Eureka server, and the Eureka server knows all the client applications running on each port and IP address. Eureka Server is also alternatively known as the Netflix Service Discovery Server. It uses Spring Cloud and is not heavy on the application development process.
50) What is the full form of DRY? What is its usage in Microservices architecture?
The full form of DRY is Don't Repeat Yourself. It is used to promote the concept of reusing the code. This makes things easy in developing and sharing the libraries, which in turn result in tight coupling.
51) How can you balance the server-side load by utilizing Spring Cloud?
We can use the Netflix Zuul to balance the server-side load by utilizing Spring Cloud. It is also known as a JVM-based router.
52) What do you understand by Cross-functional testing?
Cross-functional testing is the verification of non-functional requirements, i.e., the requirements that we cannot implement like a standard feature.
53) What is the use of Netflix Hystrix?
Hystrix is an error tolerance and latency library. It is mainly used to isolate the access points. It also ensures that all 3rd party libraries and services are restricted. So, the application runs efficiently and avoids the kind of failures that occur in distributed systems.
54) What do you understand by Tasklet in Microservices?
The Tasklet is a simple interface with a method to execute. We can use it to perform single tasks like running queries, deleting files, etc. In Spring Batch, the Tasklet is an interface used to perform unique tasks like clean or set up resources before or after any step execution.