Micro-services interview questions for fresher/Microservice Interview Questions and Answers for Freshers & Experienced

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

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.

What is Two Factor Authentication?

Two-factor authentication enables the second level of authentication to an account log-in process.

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.

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

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/

Explain Consumer-Driven Contract:

CDCs (Consumer-driven contract) is a prototype to develop services and it is being used by external systems. When you work on microservices, there is a specific provider who builds it and there will be single or multiple consumers using microservice. Typically, providers will state the interfaces within an XML document. However, in CDCs, every consumer of service communicates the interface anticipated from the Provider.

What is Distributed Transaction?

Distributed Transaction is a situation where a single event leads to the transformation of two or more disconnected sources of data that could not be allocated atomically.

What is an Actuator?

The actuator is primarily used to render operational information regarding the various parameters of a running application. These parameters are metrics, health, dump, info, env, etc. For smooth interaction, it makes use of JMX beans or HTTP endpoints.

What should be preferred communication style in microservices: synchronous or asynchronous?

1. You must use asynchronous communication while handling HTTP POST/PUT (anything that modifies the data) requests, using some reliable queue mechanism (RabbitMQ, AMQP, etc.)

2. It's fine to use synchronous communication for Aggregation pattern at API Gateway Level. But this aggregation should not include any business logic other than aggregation. Data values must not be transformed at Aggregator, otherwise, it defeats the purpose of Bounded Context. In Asynchronous communication, events should be published into a Queue. Events contain data about the domain, it should not tell what to do (action) on this data.

3. If microservice to microservice communication still requires synchronous communication for GET operation, then seriously reconsider the partitioning of your microservices for bounded context, and create some tasks in backlog/technical debt.

How big a single microservice should be?

A good, albeit non-specific, rule of thumb is as small as possible but as big as necessary to represent the domain concept they own said by Martin Fowler

Size should not be a determining factor in microservices, instead bounded context principle and single responsibility principle should be used to isolate a business capability into a single microservice boundary.

Microservices are usually small but not all small services are microservices. If any service is not following the Bounded Context Principle, Single Responsibility Principle, etc. then it is not a microservice irrespective of its size. So the size is not the only eligibility criteria for a service to become microservice.

In fact, size of a microservice is largely dependent on the language (Java, Scala, PHP) you choose, as few languages are more verbose than others.

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.

How independent micro-services communicate with each other?

It depends upon your project needs. However, in most cases, developers use HTTP/REST with JSON or Binary protocol. However, they can use any communication protocol.

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.

What do you mean by Mike Cohn’s Test Pyramid?

Mike Cohn's Test Pyramid explains the different types of automated tests needed for software development. The test pyramid is basically used to maximize automation at all levels of testing, including unit testing, service level testing, UI testing, etc. The pyramid also states that unit tests are faster and more isolated, while UI tests, which are at the top, are more time-consuming and are centered around integration.

In accordance with the pyramid, the number of tests should be highest at the first layer. At the service layer, fewer tests should be performed than at the unit test level, but greater than that at the end-to-end level

What are Reactive Extensions in Microservices?

A reactive extension, also known as Rx, is basically a design approach that calls multiple services and then generates a single response by combining the results. The calls can either be blocking or not blocking, synchronous or asynchronous. A popular tool in distributed systems, Rx works exactly opposite to legacy flows.

Explain the term ‘Continuous Monitoring.’

Continuous monitoring is a method which is used for searching compliance and risk issues associated with a company’s operational and financial environment. It contains human, processes, and working systems which support efficient and actual operations.

What is the use of Docker?

Docker offers a container environment which can be used to host any application. This software application and the dependencies that support it which are tightly-packaged together.

Explain the way to implement service discovery in microservices architecture.

There are many ways to set up service discovery, but Netflix's Eureka is the most efficient. This is a hassle-free procedure that doesn't add much weight to the application. It also supports a wide range of web applications. A number of annotations are provided by Spring Cloud to make its use as simple as possible and to hide complex concepts.

Explain the term Eureka in Microservices.

Eureka Server, also referred to as Netflix Service Discovery Server, is an application that keeps track of all client-service applications. As every Microservice registers to Eureka Server, Eureka Server knows all the client applications running on the different ports and IP addresses. It generally uses Spring Cloud and is not heavy on the application development process.

Explain Idempotence and its usage.

The term 'idempotence' refers to the repeated performance of a task despite the same outcome. In other words, it is a situation in which a task is performed repeatedly with the end result remaining the same.

Usage: When the remote service or data source receives instructions more than once, Idempotence ensures that it will process each request once

What do you mean by Distributed Transaction?

Distributed transactions are an outdated approach in today's microservice architecture that leaves the developer with severe scalability issues. Transactions are distributed to several services that are called to complete the transaction in sequence. With so many moving parts, it is very complex and prone to failure.

Explain OAuth.

Generally speaking, OAuth (Open Authorization Protocol) enables users to authenticate themselves with third-party service providers. With this protocol, you can access client applications on HTTP for third-party providers such as GitHub, Facebook, etc. Using it, you can also share resources on one site with another site without requiring their credentials.

What are the challenges faced while using Microservices?

>> Microservices always rely on each other. Therefore, they need to communicate with each other.

>> As it is distributed system, it is a heavily involved model.

>> If you are using Microservice architecture, you need to ready for operations overhead.

>> You need skilled professionals to support heterogeneously distributed microservices.

Discuss uses of reports and dashboards in the environment of Microservices

Reports and dashboards help in monitoring and upkeep of Microservices. Tons of Application Monitoring Tools assist in this.

Name some famous companies that use Microservice architecture.

Microservices architecture has replaced monolithic architecture for most large-scale websites like:

* Twitter
* Netflix
* Amazon, etc.

Explain CDC.

As the name implies, CDC (Consumer-Driven Contract) basically ensures service communication compatibility by establishing an agreement between consumers and service providers regarding the format of the data exchanged between them. An agreement like this is called a contract. Basically, it is a pattern used to develop Microservices so that they can be efficiently used by external systems.

What do you mean by client certificates?

The client certificate is a type of digital certificate that generally allows client systems to authenticate their requests to remote servers. In many mutual authentication designs, it plays a key role in providing strong assurance of the requestor's identity.

Explain how independent microservices communicate with each other.

Communication between microservices can take place through:

* HTTP/REST with JSON or binary protocol for request-response
* Websockets for streaming.
* A broker or server program that uses advanced routing algorithms.

RabbitMQ, Nats, Kafka, etc., can be used as message brokers; each is built to handle a particular message semantic. You can also use Backend as a Service like Space Cloud to automate your entire backend.

What do you mean by Bounded Context?

A Bounded Context is a central pattern in DDD (Domain-Driven Design), which deals with collaboration across large models and teams. DDD breaks large models down into multiple contexts to make them more manageable. Additionally, it explains their relationship explicitly. The concept promotes an object-oriented approach to developing services bound to a data model and is also responsible for ensuring the integrity and mutability of said data model.

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 this, PACT creates a stub against which the test is executed. The output is stored in a JSON file.

Why Would You Need Reports and 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.

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:

* 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.

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 are the advantages and disadvantages of Microservices?

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.

What is end-to-end testing Of Microservices?

End to End testing authenticates every process within the workflow to make sure everything works flawlessly. Also, it makes sure the system functions in an incorporated manner, and therefore, meeting the business needs. The corresponding tests can encompass the gaps during integration testing or unit testing. Also, it makes sure that the network parameters are properly configured and facilitates the advancement of microservices.

What is RESTful?

RESTful also known as REST (Representational State Transfer) web service is basically an architectural style that assists the computer systems to seamlessly communicate across the Internet. Such web services let it easier to understand and deploy microservices.

What is API Gateway?

API Gateway is an exceptional class of microservices that fulfills the requirement of a single client application. Also, it serves the backend resources i.e. microservices with a single entry point. Hence, there are no more concerns related to monitoring, security, and flexibility. API Gateway uses a client-side load balancer library to spread load all over the instances depending on round-robin fashion.

Why Microservices use containers?

Containers are the simplest and efficient method to handle all the microservice-based application. Moreover, it assists you to develop and implement separately. Microservice can utilize the containers without extra effort.

Which are the popular companies implementing Microservice architecture?

The majority of the large-scale websites such as Netflix, Uber, Amazon, eBay, Twitter, and Spotify have adopted microservices architecture.

Define coupling and how are the microservices coupled?

Coupling is the extent of interdependence between software modules. In simple terms, it represents proximity connected to two modules or routines. The microservices are loosely coupled with one another.

What are the cases when you need to consider microservice architecture?

Following are the cases where you need to implement microservice architecture:

1. You already use a monolith application and later it advances to a level where there are issues in scaling.
2. You cannot reutilize the modules or components or services over various platforms of projects.
3. Execution of new features is difficult and prone to errors.

Explain the challenges found in Microservice deployment?

The deployment of Microservice needs huge investment and a huge infrastructure setup. The management for application, configuration, and staff selection becomes difficult. Moreover, the communication is complex and there are several security threats. At times, it becomes difficult to test and debug the services. An organization needs extreme planning for managing operations overhead.

What are the main differences between Microservices and Monolithic Architecture?

Monolithic architecture is generally tightly coupled whereas Microservices architecture is loosely coupled. Microservices focus on products rather than projects; the reverse is true for Monolithic. The service startup is faster in microservice than monolithic architecture. In a microservice architecture, any changes implemented in a single data model does not influence other microservices. But in monolithic architecture, any modifications in the data model influence the whole database.

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 layer to figure out the transactions affected by availability or poor performance.

Discuss uses of reports and dashboards in the environment of Microservices

Reports and dashboards help in monitoring and upkeep of Microservices. Tons of Application Monitoring Tools assist in this.

What is Spring Cloud?

Spring cloud is an Integration software that integrates with external systems. It allows microservices framework to build applications which perform restricted amounts of data processing.

Explain how you can override the default properties of Spring boot projects.

By specifying properties in the application.properties file, it is possible to override the default properties of a spring boot project.

Example:

In Spring MVC applications, you need to specify a suffix and prefix. You can do this by adding the properties listed below in the application.properties file.

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

What is the role of actuator in spring boot?

A spring boot actuator is a project that provides restful web services to access the current state of an application that is running in production. In addition, you can monitor and manage application usage in a production environment without having to code or configure any of the applications.

Write main components of Microservices.

Some of the main components of microservices include:

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

Name three commonly used tools for Microservices

1.) Wiremock, 2.) Docker and 3.) Hysrix are important Microservices tool.

Explain microservices architecture

Microservice Architecture is an architectural development style which builds an application as a collection of small autonomous services developed for a business domain.

Search
R4R Team
R4R provides Microservice Freshers questions and answers (Microservice Interview Questions and Answers) .The questions on R4R.in website is done by expert team! Mock Tests and Practice Papers for prepare yourself.. Mock Tests, Practice Papers,Micro-services interview questions for fresher,Microservice Freshers & Experienced Interview Questions and Answers,Microservice Objetive choice questions and answers,Microservice Multiple choice questions and answers,Microservice objective, Microservice questions , Microservice answers,Microservice MCQs questions and answers Java, C ,C++, ASP, ASP.net C# ,Struts ,Questions & Answer, Struts2, Ajax, Hibernate, Swing ,JSP , Servlet, J2EE ,Core Java ,Stping, VC++, HTML, DHTML, JAVASCRIPT, VB ,CSS, interview ,questions, and answers, for,experienced, and fresher R4r provides Python,General knowledge(GK),Computer,PHP,SQL,Java,JSP,Android,CSS,Hibernate,Servlets,Spring etc Interview tips for Freshers and Experienced for Microservice fresher interview questions ,Microservice Experienced interview questions,Microservice fresher interview questions and answers ,Microservice Experienced interview questions and answers,tricky Microservice queries for interview pdf,complex Microservice for practice with answers,Microservice for practice with answers You can search job and get offer latters by studing r4r.in .learn in easy ways .