Microservices Questions

Primary tabs

Questions concerning microservices that may be asked in a interview

Bookmark to learn: Login to use bookmarks.


'Repetition is the mother of all learning.'

Bookmark to learn: Login to use bookmarks.

Add to collection ... add Microservices Questions to your collections:

Help using Flashcards ...just like in real life ;)

  1. Look at the card, do you know this one? Click to flip the card and check yourself.
  2. Mark card Right or Wrong, this card will be removed from the deck and your score kept.
  3. At any point you can Shuffle, Reveal cards and more via Deck controls.
  4. Continue to reveal the wrong cards until you have correctly answered the entire deck. Good job!
  5. Via the Actions button you can Shuffle, Unshuffle, Flip all Cards, Reset score, etc.
  6. Come back soon, we'll keep your score.
    “Repetition is the mother of all learning.”
  7. Signed in users can Create, Edit, Import, Export decks and more!.

Bookmark to learn: Login to use bookmarks.

Share via these services ...

Email this deck:

Right: #
Wrong: #
# Right & # Wrong of #

What do you understand by Microservices?

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.

What are the main features of Microservices?

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.

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.

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

How does a Microservice Architecture work?

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.

What are the fundamental characteristics of a Microservices Design?

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.

What are the main challenges in Microservice Deployment?

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 a technical standpoint –

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

What are the advantages and disadvantages of Microservices?


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.

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.

What are the different strategies of Microservices Deployment?

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.

What is a AWS lambda function?

AWS Lambda is a serverless compute service that runs your code in response to events and automatically manages the underlying compute resources for you. You can use AWS Lambda to extend other AWS services with custom logic, or create your own back-end services that operate at AWS scale, performance, and security.

What is a Monolithic Architecture, compared to SOA, and Microservices?

In Monolithic Architecture, all software components of the application are assembled and packed tightly.

What is a SOA Architecture, compared to Monolithic, and Microservices?

SOA [Service Oriented Architecture] is a collection of services that communicate with each other through simple data passing or activity coordination.

What is a Microservices Architecture, compared with Monolithic, and SOA?

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.

What is Domain Driven Design?

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:

1. Focus on the core domain and domain logic.
2. Base complex designs on models of the domain.
3. Regularly collaborate with the domain experts to improve the application model and resolve any emerging domain-related issues.

What is the Spring Boot?

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.

What is an Actuator?

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.

What is a Container?

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.

What are Coupling and Cohesion?

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.

What is PACT in Microservices Architecture?

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.

What is Contract Testing?

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.

What is OAuth?

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 logon credential. This is also known as secure, third-party, user-agent, delegated authorization.

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

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.

What are the steps in an End-to-End Microservices Testing?

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

What is the difference between Mock & Stub?

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.

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

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.

How does Docker help in Microservices?

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.

What is Canary Releasing?

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.

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

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.

What is a Client Certificate?

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.

What is a CDC [Consumer Driven Contract]?

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.

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

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:

Remote Services
Resource Leaks

What are Reactive Extensions in Microservices?

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.

What is the role of RESTful APIs in Microservices?

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.

What is Eureka in Microservices?

Eureka is alternatively known as the Netflix Service Discovery Server. It uses Spring Cloud and is not heavy on the application development process.

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

The server-side load balancing can be done by using Netflix Zuul. It is also known as a JVM based router

When will you see fit to use the Netflix Hystrix?

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.

What is Spring Batch Framework?

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.

What is Tasklet, and what is a Chunk?

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.

How will you deploy Exception Handling in Microservices?

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.