Top 80 Microservices Interview Questions and Answers

Microservices can be defined as an architectural design for building the distributed application by using containers. Microservices get their name as each and every function of the application will operate as an independent service. This kind of architecture will allow each service to update or scale without disrupting other services in an application.

If you are looking for the most frequently asked Microservices Interview Questions and Answers, then you are on the right page. We have noted the frequently asked Microservices Interview Questions. Please go through the entire post.

Table of Contents

Top Microservices Interview Questions

1. Can you explain Microservices architecture?

Microservices Interview Questions - Architecture

Microservices, also called microservice architecture – Can be defined as an architectural style that will structure an application as a group of services that are. Highly testable and maintainable. 

  1. They are loosely coupled.  
  2. They can also be Independently deployable. 
  3. Organized around business capabilities
  4. Owned by a small team

2. Define Spring Cloud?

Spring Cloud can be stated as a framework that is used to build robust cloud applications. Applications that will run with the microservices architecture aim to simplify deployment, development, and maintenance. The decomposed nature of an application will allow the developers to focus on only one problem at a time.

3. List the main features of Microservices?

  1. Lightweight containers. 
  2. Polyglot programming environment. 
  3. Out-of-the-box capabilities
  4. Security
  5. Mediation and intelligent routing
  6. Hot “swap-ability: Having the hot-swapping support is essential to get a container provisioned at the run time or replacing, deprecating, or adding the new microservices.
  7. Monitoring and manageability

4. Can you list the commonly used tools for Microservices?

  1. MongoDB: It can be defined as a document-based open-source distributed database. Here the data is usually stored in a JSON format with a different structure for various documents. It can also support a lot of other programming languages such as C, Python, Java, C++, C#, PERL, PHP, Ruby, Scala, etc.
  2. Docker: The application development environment and the application deployment environment vary in many aspects. This will give rise to deployment issues. Docker will provide a static background for an application to run; hence it avoids deployment issues.
  3. JAEGER: It can also be defined as an open-source end-to-end distributed tracing tool. Jaeger will monitor the distributed transactions, and it helps in performance optimization, and it will find the dependencies b/w services. It gives the root cause for analysis.
  4. JENKINS: It is an automation tool that will enable Continuous Integration and Continuous Development. It will support various plugins and can easily integrate with almost every tool.
  5. Elasticsearch: It can be defined as a full-text search engine.
  6. Grafana: Grafana aims to provide analytics and monitoring into various visualization formats such as graphs, charts, tables, etc.

5. Define Spring Boot?

Spring Boot will enable building production-ready applications quickly, and it provides non-functional features: Embedded servers that are easy to be deployed with the containers. It will help to monitor the multiple components. It also helps in configuring components externally.

6. List the main components of Microservices?

  1. Containers, Clustering, and Orchestration
  2. IaC [Infrastructure as Code Conception]
  3. Cloud Infrastructure
  4. API Gateway
  5. Enterprise Service Bus
  6. Service Delivery

7. Define Monolithic Architecture?

Monolithic architecture is usually built as one large system and is one code-base. A monolithic application will be tightly coupled and entangled as an application evolves, making it very difficult to isolate services for purposes like independent scaling or code maintainability.

8. How to Override a Spring Boot Project’s Default Properties?

It can be performed by specifying the properties in an application.properties file

For instance, in the Spring MVC applications, you should specify the suffix and prefix. This is usually done by entering the properties that are mentioned below in an application.properties file

For suffix – spring.mvc.view.suffix: .jsp

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

9.  Explain how Microservice Architecture works?

The main idea behind the microservice architecture is that applications are simple to build and maintain when they are typically broken into smaller pieces that will work seamlessly together. While using microservices, we isolate software functionality into various independent modules that will be individually responsible for performing precisely defined, standalone tasks. These modules now communicate with each other via simple, universally accessible (APIs) application programming interfaces.

Applications that are built using microservices have certain characteristics, they are:

  1. They have individual functions built to align with business capabilities.
  2. They are fragmented into various modular, loosely coupled components, each of them performs a discrete function.
  3. They can be easily distributed across clouds and data centers.
  4. They will treat each function as an independent service that can be updated, changed, or deleted without disrupting the other application.

 10. List the advantages of Microservices?

Advantages:

  1. Easier to Build and Maintain Apps.
  2. Organized Around Business Capabilities
  3. Improved Productivity and Speed
  4. Flexibility in using the Technologies and Scalability
  5. Autonomous, Cross-functional Teams.
See also  Top 100 MySQL Interview Questions And Answers

Microservices Interview Questions and Answers

11. Name the Embedded Containers that are supported by Spring Boot?

When we create a Java application, deployment can be done through two methods:

  1. By using an application container that will be external
  2. By embedding the container inside the jar file

The embedded containers that are supported by Spring boot are given below:

Tomcat – Apache Tomcat can be defined as an open-source JavaServer Pages implementation that will work well with the embedded systems.

Jetty – It is usually used in a wide number of projects; we can embed Eclipse Jetty in framework, application servers, tools, and clusters.

Undertow – It is one of the flexible and prominent web servers that will make use of small single handlers to develop a web server.

12. Can you list the uses of reports and dashboards in the environment of Microservices?

Reports and dashboards are usually used to monitor and upkeep microservices. Reports and dashboards are used to: 

  1. Find out which microservices expose what resources.
  2. Find out services that are impacted whenever changes in the component occur.

13. List the main challenges in Microservice Deployment?

Few challenges are listed below:

  1. The traditional forms of monitoring will not work for a microservices-based application. 
  2. Scalability is another operational challenge that is associated with microservices architecture.
  3. Optimizing and scaling will require more complex coordination.
  4. Fault tolerance is needed for every service.

14. Differentiate between Microservices and Monolithic Architecture?

MicroservicesMonolithic Architecture
Microservices are loosely coupled architecture.Monolithic architecture can be stated as the most tightly coupled.
It focuses on products, not projects.It emphasizes the whole project.
Here, Service Startup is fastHere, service startup takes time.

Top Microservices Interview Questions

15. Define the term End-To-End Testing of Microservices?

End-to-end testing in Microservices can be defined as a testing technique that is used to test the flow of the application via a business transaction. In a microservices architecture, there are various components that will be working together to ensure a business capability; hence testing all of them can get tricky.

16. Disadvantages of Microservices?

Disadvantages:

  1. There might be higher chances of failure during the communication between various services.
  2. Complex testing over the distributed environment
  3. Microservices have all the associated complexities of a distributed system.
  4. The developer has to solve the problem, like network latency and load balancing.
  5. It will be difficult to manage a large number of services.

17. Define Semantic Monitoring?

In Microservices, Semantic monitoring is also known as synthetic monitoring, will run a subset of the application’s automated tests against a live production system on a regular basis. This process usually combines automated testing with monitoring to detect failing business requirements in the production.

18. List the different strategies of Microservices Deployment?

  1. Service Instance per Host:  It will Run a service instance per host.
  2. Serverless Deployment: Iy will Package the service as a ZIP file, and it will upload it to the Lambda function. Here, the Lambda function can be defined as a stateless service that will automatically run enough micro-services to handle all the requests.
  3. Service Instance per Container: It will Run each service instance in its specified container.
  4. Multiple Service Instance per Host: It will Run single or multiple service instances of an application on single or multiple physical or virtual hosts.

19. List the challenges that are faced while using Microservices?

Challenges faced:

  1. Component automation
  2. Application maintenance
  3. Communication between various services in an application
  4. Configuration Management
  5. Heavy Operations Overhead
  6. Deployment Challenges
  7. Testing and Debugging Challenges

20. List the cases where microservice architecture is best suited?

Microservice architecture is best suited for

  1. Desktop
  2. Web
  3. Mobile devices
  4. Smart TVs
  5. Wearable, etc.

Microservices Interview Questions

21. Why should we go for Microservices Architecture?

Reasons:

  1. Increased resilience
  2. Improved scalability
  3. The ability to use the right tool for a right task
  4. Faster time to market
  5. Easier debugging and maintenance
  6. Improved ROI with reduced TCO
  7. Continuous delivery

22. Define Domain-Driven Design?

Domain-driven design (DDD) usually advocates modeling that is based on the reality of business as relevant to the use cases. In the context of building the applications, DDD will talk about problems as domains. In addition, DDD approaches are applied if we are implementing complex microservices with a significant business rule.

23. Can you list some companies which are using Microservice architecture?

Most of the large-scale websites such as

  1. Twitter
  2. Netflix,
  3. Amazon has advanced from monolithic architecture to microservices architecture.

24. Why do people hesitate to use Microservices Architecture?

  1. They require heavy investment. 
  2. They need heavy architecture set up. 
  3. They need excessive planning for handling the operations overhead.
  4. They have autonomous staff selection. 

25. Differentiate between Cohesion and Coupling?

CohesionCoupling
Cohesion usually talks about how we organize the code.Coupling usually talks about how to change one thing needs a change in another.
Cohesion is a relationship between 2 or multiple parts within a module.Coupling is the relationship between module A and module B. 

Top Microservices Interview Questions

26. List the characteristics of Microservices?

Characteristics:

  1. Componentization via Services.
  2. Organized around Business Capabilities.
  3. Products, not Projects.
  4. Smart endpoints and dumb pipes
  5. Decentralized Governance.
  6. Decentralized Data Management.
  7. Infrastructure Automation.
  8. Design for failure.

27. How will PACT work?

The Pact Framework can be defined as an Implementation of Consumer Driven Contracts. They are nothing but simple JSON files that will define the expected request and response structure between the two microservices. Docker will enable the microservices to be platform-independent.

28. Define Mike Cohn’s Test Pyramid?

Mike Cohn’s Test Pyramid

This pyramid helps us to maximize automation at all levels of testing, that is, unit testing, service level testing, UI testing. This pyramid will indicate that while unit tests are faster and isolated, the UI tests, which are at the highest level, takes time and focuses on integration.

29. What is RESTful?

The terms such as RESTful API and Microservices go hand-in-hand while building a microservices-based application. RESTful APIs can be defined as the rules, routines, protocols, and commands or the glue that will integrate the individual microservices so that they can function as a single application.

30. How to configure the Spring Boot application login?

The Spring Boot Application Login is usually configured by specifying the logging level in an application. Properties file. It is pre-configured as the console output.

Microservices Interview Questions

31. Can you explain three types of Tests for Microservices? 

Microservice architecture tests are usually divided into three broad categories:

The bottom level test: here, we can do general tests like performance and unit tests. These tests are entirely automated.

The middle level: here, we can perform exploratory tests such as the stress tests and usability tests.

The top-level: here, we can perform acceptance tests that are fewer in numbers. It helps the stakeholders to know about various software features.

32. What is an Actuator?

The actuator is usually used to expose the operational information about a running application such as health, info, metrics, dump, env, etc. It will make use of the  HTTP endpoints or JMX beans to allow us to interact with it. Once this dependency is on a classpath, several endpoints are then made available for us out of the box.

33. What are Client Certificates?

Client certificates are mainly used to authenticate the client identity to the server. There is no encryption of data in the case of Client certificates. Server Certificates are usually based on PKI. The Client certificates are also based on PKI.

34. Define Container?

Container

Containers in microservices are easily packaged, lightweight, and they are designed to run anywhere. We can also deploy multiple containers in a single VM. A microservice is usually an application with a single function, like routing network traffic, or analyzing a medical result, or making an online payment.

35. Define OAuth?

OAuth 2 in microservices can be defined as an authorization framework, a security concept for the rest of API, and it’s all about how you authorize the user to get access to a resource from the resource server using a token. 

36. Define CDC?

CDC can be defined as a Consumer-Driven Contract. It is usually a pattern to develop Microservices so that external systems can make use of them.

37. What is Contract Testing?

The Contract Testing will ensure that explicit and implicit contracts of the microservice architecture will work as expected. There are typically two perspectives to contract to test, i.e., Consumer and Provider. 

  1. Here, the consumer is the [application] entity that is using the microservice.
  2. Here, the provider is the [application] entity that is providing the service.
  3. Such kinds of services work under some predefined specifications, and the contract testing ensures so.
See also  Top 100 Hive Interview Questions And Answers

38. Why do we use Docker?

In microservices, With Docker, one can make the application independent of a host environment. Since we have microservices architecture, we can encapsulate each of them into Docker containers. Docker containers are usually lightweight, resource-isolated environments through which one can build, ship, maintain, and deploy the application.

39. Can you list the ways to access RESTful Microservices?

We can do that through two methods:

  1. By using a REST template that will be load balanced
  2. By using multiple microservices

40. Define Reactive Extensions in Microservices?

Reactive programming in microservices is basically an asynchronous programming mechanism that will emphasize being non-blocking during the execution of the program. It usually follows a data flow technique where the execution will be advanced, and when the data is available, the execution is never blocked on resources.

Microservices Interview Questions

41. Define Conway’s Law?

Conway’s Law in microservices states that “any organization that will design a system has to produce a design whose structure will be a copy of organization’s communication structure.” This has a very significant impact on how the software will be built, especially if microservices and  Domain-Driven Design are adopted.

42. Can you list some major roadblocks for Microservices Testing?

  1. With the increase in the no of microservices, the complexity of the system will also increase.
  2. Testers must have a thorough understanding of all the outbound and inbound processes before they start writing test cases for integration testing.
  3. While transitioning from monolithic architecture, testers must make sure that there is no disruption b/w the internal communication within the components.
  4. When independent teams are working on various functionalities, collaboration can be quite a struggling task. It will be tough to find an idle time window in order to perform a complete round of regression testing.

43. List the steps in an End-to-End Microservices Testing?

Steps:

  1. You need to define what you expect from end-to-end testing.
  2. You should also define the scope of the system to be tested.
  3. You should perform authentication in a test environment.
  4. Choose a testing framework that will address most of the issues.
  5. Test Asynchronous flows
  6. Automate Testing

44. Define the term Continuous monitoring?

Continuous deployment in Microservices is defined as the act of actually deploying the results of a CI/CD cycle. The point of continuous deployment is to speed up the release of new features into the market by releasing them as early as they pass the CI/CD muster.

45. What are the common mistakes Made while transitioning to Microservices?

  1. Often the developer will fail to outline the current challenges.
  2. The programmers will rewrite the programs that are already existing.
  3. Responsibilities, timeline, and boundaries will not be defined.
  4. They fail to implement and figure out a scope of automation from the beginning.

46. Differentiate between Mock & Stub?

MockStub
A Mock can be defined as a dummy object where certain features are usually set into it initially. A Stub can be defined as an object that will help in running the test. It will function in a fixed manner under specific conditions.
Its behavior depends on these features, which are then tested.This hard-coded behavior will help the stub to run the test.

47. How will the independent micro-services communicate with each other?

It usually depends upon your project requirements. In most cases, developers will make use of HTTP/REST with the JSON or Binary protocol. But, they can use any communication protocols.

48. Can you list the fundamentals of Microservices design?

  1. First, you need to define a scope.
  2. Combine the loose coupling with high cohesion.
  3. Create a unique service that will act as the identifying source, like a unique key in the database table.
  4. Create a correct API and take special care during the integration.
  5. Restrict access to the data and limit it to a required level.
  6. Maintain a smooth flow b/w the requests and responses.
  7. Automate processes to reduce the time complexity.
  8. Keep the no of tables to a minimum level in order to reduce the space complexity.
  9. Monitor the architecture constantly and fix if any flaws are detected.
  10. Datastores must be separated for each microservices.
  11. For each and every microservice, there must be an isolated build.
  12. Deploy microservices into the containers.
  13. Servers must be treated as stateless.

49. What can you derive from Mike Cohn’s Test Pyramid?

 Mike Cohn’s Test Pyramid specifies the type of automated tests that are required for any software development. The Test Pyramid can be defined as a metaphor that will imply a grouping of tests that are based on their granularity. This Pyramid will tell which kind of tests are to be applied to various levels of the pyramid.

Mike Cohn’s test pyramid contains three layers:

  1. Unit Testing
  2. Service Testing
  3. User Interface Testing.

The points to be derived from Cohn’s pyramid is:

  1. The higher the level you get, the fewer tests you must have.
  2. We must define tests with various granularities.

50. What is Bounded Context?

In Microservices, each of the bounded contexts consists of a domain model that will represent a specific subdomain of a larger application. Within the bounded context, apply tactical DDD patterns to define the entities, domain services, and aggregates. We make use of the results from the previous step in order to identify the microservices in the application.

Microservices Interview Questions

51. Define Canary Releasing?

Canary deployment is also known as the canary release, can be defined as a microservices pattern that must be part of every continuous delivery strategy. This pattern will help the organizations to deploy new releases to production, at first to a subset of users, before making the changes available to everyone.

52. List the various types of credentials of a two-factor Authentication?

(2FA)Two-factor authentication can be defined as a method of establishing access to the online account or a computer system that will require the user to provide two different types of information. With the two-factor authentication, you will need to provide a password and also prove your identity in some other way in order to gain access.

Types:

  1. A thing that you know, such as password or pin or a screen lock pattern.
  2. A physical credential that you may have, such as an OTP or phone or an ATM card, in simple words, any kind of credential that you may have in the external or a third-party device.
  3. Your physical identities, such as your voice authentication or biometric security, such as fingerprint or eye scanner

53. Define Idempotence and how is it used?

Idempotence is usually referred to as a scenario where we can perform a task repetitively, but the end result will remain constant or similar.

Idempotence is most commonly used as a data source or the remote service in such a way that when it receives multiple sets of instructions, it will process only one set of instructions.

54. Define non-deterministic tests and how to eliminate them?

Non-Deterministic*NDT) can be defined as an unreliable test. Such tests may sometimes pass and may sometimes fail. When these tests are failed, they are re-run to give. We can eliminate Non-Determinism from tests in the following ways:

  1. Remote Services
  2. Isolation
  3. Quarantine
  4. Asynchronous
  5. Time
  6. Resource Leaks

55. Define Eureka in Microservices?

Eureka Server can be defined as an application that will hold the information about all the client-service applications. Each and every Microservice has to register into the Eureka server, and the Eureka server will know all the client applications that are running on each port and IP address. Eureka Server is also called Discovery Server.

56. Define Zuul?

Zuul Server can be defined as an API Gateway application that will handle all the requests and will perform the dynamic routing of the microservice applications. It will work as a front door for all the requests. It is also called an Edge Server. Zuul is built to allow dynamic routing, resiliency, monitoring, and security.

57. How to balance the server-side load by utilizing Spring Cloud?

The server-side load balancing is done using Netflix Zuul. It is also called a JVM-based router.

58. Define Spring Batch Framework?

A Spring Batch can be defined as a minimalistic framework that is used to run batch processing applications. Spring Cloud Task can also be defined as a  wrapper that allows you to run short-lived microservices by using the Spring Cloud along with the Spring Boot. Spring Cloud Data Flow will allow us to build composed tasks orchestrating Spring Batch jobs as the Spring Cloud Tasks.

59. How to deploy Exception Handling in Microservices?

Exception handling is nothing but responding to the exceptions whenever a computer program runs. An exception will occur when an unexpected event happens that may require special processing. Exception handling attempts to handle these kinds of situations so that a program does not crash.

See also  Top 100 MySQL Interview Questions And Answers

To deploy, follow the steps:

  1. Let us set up a basic spring micro-service. 
  2. Let us add a controller endpoint with a request model. 
  3. Add a global exception handler. …
  4. Add custom exception or error messages enum.
  5. Populate field validation messages.
  6. Throw all the service and the controller exceptions.
  7. Unit Test for validations.

60. What is Tasklet?

In the Spring batch, the Tasklet can be defined as an interface that is called to perform only a single task, such as cleaning or set up resources before or after any step executions. 

Microservices Interview Questions

61. What is a Chunk?

Spring Batch will make use of a ‘Chunk Oriented’ processing style within its most common implementation. Chunk Oriented Processing often refers to reading data one at a time, and it creates chunks that are written out within the transaction boundary.

62. How to do security testing of Microservices?

Microservices Application can be stated as a collection of small, independent, functional modules that will be developed in various programming languages, and have various data sources, and will run on different OS. This will make the testing of microservices an entire very tough task. The various pieces or modules have to be tested independently. There are usually three common procedures for this.

  1. Adaptability: The security protocols have to be adaptable to malicious intrusions.
  2. Code Scanning: To ensure that each and every line of code is bug-free and is replicated.
  3. Flexibility: The security protocols must be flexible as per the needs of the system.

Top Microservices Interview Questions

63. How to create State Machines out of Microservices?

Each microservice has its own database, and they are independently deployable programs. This allows the creation of State Machines where we can specify different states and events for a specific microservice.

64. Where we usually use the WebMVC Test Annotation?

WebMvcTest Annotation is mainly used for unit testing the Spring MVC Applications, where the test objective mainly focuses on Spring MVC Components.

65. List the key differences between SOA and Microservices Architecture?

SQAMicroservices Architecture
It gives importance to business functionality reuse.It gives importance to the concept of “bounded context.”
It will follow the “share-as-much-as-possible” architecture approach.It usually follows the “share-as-little-as-possible” architecture approach.
It supports multiple message protocols.It mainly uses lightweight protocols like HTTP/REST etc.
It uses Enterprise Service Bus (ESB) for communications.It uses a Simple messaging system.

66. What is Ubiquitous language?

Ubiquitous Language can be defined as a common language that is used by the developers and users of a particular domain where the domain can be explained easily.

The ubiquitous language must be crystal clear so that we can bring all the team members on the same level and can also translate in such a way that a machine understands.

67. What are the problems that are being solved by Spring Cloud?

  1. The complexity associated with distributed systems
  2. Ability to handle Service Discovery.
  3. Redundancy issues that will occur in distributed systems.
  4. It improves the distribution of workloads across various computing resources, like a computer cluster,  central processing units, network links.
  5. It will reduce the performance issues that are caused due to various operational overheads.

68. What is Distributed Transaction?

Distributed Transaction can be defined as a single event result in the mutation of two or multiple separate sources of data that can’t be committed atomically. In terms of microservices, it is even more complex because each service is a unit of work, and the multiple services must work together to make the business successful.

69. Define DRY in Microservices architecture?

DRY in Microservices means Don’t Repeat Yourself. It promotes the concept of reusing the code. This will; result in developing and sharing the libraries and result in tight coupling.

70. How to do Cross-Functional testing?

Cross-functional testing is usually a verification of the non-functional requirements, that is, those requirements that cannot be implemented like a normal feature.

Microservices Interview Questions

71. Describe the role of an architect in Microservices architecture?

  1. He/she has to decide the broad strokes about the layout of an overall software system.
  2. They help in deciding the zoning of components so that they ensure that the components are mutually cohesive and are not tightly coupled.
  3. They have to code with developers and learn the challenges that are faced in day-to-day life.
  4. They should make recommendations for certain tools and technologies to the developing teams of microservices.
  5. They must provide technical governance so that the teams in their technical development follow the principles of Microservice.

72. How to implement Spring Security In a Spring Boot Application?

You need to add a spring-boot-starter-security starter in file pom.xml. You must also create a Spring config class that will be overriding the required method while extending a WebSecurityConfigurerAdapter in order to achieve security in an application. 

73. How to set up Service Discovery?

One such way to set up service discovery is Eureka by Netflix. It is a hassle-free process, and it does not weigh much on an application, and it also supports n-types of web applications.

Eureka configuration usually involves two steps – Client configuration and server configuration.

  1. The client configuration is done easily by making use of the property files. In the classpath, Eureka will search for eureka-client.properties., and It also searches for overrides that are caused by the environment in the property file, which is environment-specific.
  2. For server configuration, you need to configure the client first. Once the setup is done, the server will fire up a client that will be used to find other servers. The Eureka server, by default, will use the Client configuration to find a peer server.

73.Why people hesitate to use Microservices?

  1. Requires heavy investment 
  2. Heavy architecture set up.
  3. Excessive planning for handling operations overhead
  4. Autonomous staff selection

74. How can we configure Spring Boot Application logging?

Spring Boot has added support for Log4J2, Logback, and Java Util Logging. It is pre-configured as a console output. It is configured by only specifying the logging.level in an application.properties file.

logging.level.spring.framework=Debug

75. How to scale a microservice-based system?

  1. We scale the system by increasing the no of instances of service by bringing more containers.
  2. We can apply to cache at microservice layer, which is easy to manage as an invalidation of the cache, and it is done very easily as the microservice is a single source of truth.
  3. Caching has to be introduced at the API Gateway layer, where we define caching rules, such as when to invalidate the cache.
  4. We also shut down few containers when the requirement is less. That is,  known as scale down.

76. Define Polyglot persistence?

Polyglot persistence is about using various databases for different business needs within a single distributed system. We have different database products available  in the market, each for a particular business need, for example: 

  1. RDBMS
  2. MongoDB
  3. Redis
  4. Neo4j
  5. Cassandra

77. What is a 12-factor app?

The Twelve-Factor App is a recent methodology for writing web applications that run as a service.

  1. Codebase: One codebase, we can have multiple deploys. 
  2. Dependencies: The manifesto has advised against relying on software or libraries on a host machine. Every dependency must be put into pom.xml or build.gradle file. 
  3. Config: Store config in the environment. 
  4. Backing services: Treat the backing services as attached resources. A microservice must treat the external services equally, regardless of, you manage them or some other team. 
  5. Release & Run: It Strictly separates build and run stages.
  6. Processes: It will execute the app as one or multiple stateless processes. 
  7. Port Binding: Export services through port binding. This is all about having the application as standalone instead of relying on some running instance of an application server.
  8. Concurrency: Scale-out through the process model; in the twelve-factor app, processes are always a  first-class citizen. 
  9. Disposability: The twelve-factor app’s processes are made disposable, which means that they can be started or stopped at a moment’s notice. 
  10. Dev/Prod parity: it means to keep development, staging, and production as similar as possible. 
  11. Logs: Here, we treat logs as event streams by sending all logs only to stdout. 
  12. Admin processes: here, we run admin/management tasks as one-off processes. For instance, a database migration must be run using a separate process altogether.

78. Should we prefer a synchronous or asynchronous style of communication in Microservices?

  1. You choose to use asynchronous communication while handling the HTTP POST/PUT requests by using some reliable queue mechanisms such as RabbitMQ, AMQP, etc.
  2. Sometimes, it is ok to use synchronous communication for the Aggregation pattern at API Gateway Level. But this aggregation must not include any business logic other than the aggregation. 

79. How frequently should a microservice be released into production?

There is no perfect answer to this kind of question; there could be a release for every 10 minutes, or, every hour, or once a week. It will depend on the extent of automation we have at various levels of the software development lifecycle – build automation, deployment automation, test automation, and monitoring. And it also depends on the business requirements, like how small, low-risk changes you care to make in a single release.

80. How to eliminate non-determinism in tests?

Non-Deterministic Tests (NDT) are unreliable tests. Hence, it may happen that they can pass, and obviously, they may fail also. When they fail, they are again made to re-run to pass.

A few ways to remove non-determinism from tests are:

  1. Quarantine
  2. Asynchronous
  3. Remote Services
  4. Isolation
  5. Time
  6. Resource leaks

Good luck with your Microservice Interview, and we hope our Microservices Interview Questions and Answers were of some help to you. You can also check our MongoDB Interview Questions and Answers and Java Interview Questions which might be of some help to you.

Recommended Articles