Top Microservices Interview Questions for 2019, Part 1

DZone 's Guide to

Top Microservices Interview Questions for 2019, Part 1

We take a look at some questions you can expect to come across when interviewing for a microservices developer or architect role.

· Microservices Zone ·
Free Resource

survey by Nginx shows that 36% of enterprises are currently using microservices, while another 26% are doing research on how to implement them. So now could be a good time to get into microservice development. Read on for an overview of some of the most common microservices interview questions. 

1. What Is Spring Cloud?

 Spring Cloud, in microservices, is a system that provides integration with external systems. It is a short-lived framework that builds an application, fast. Being associated with the finite amount of data processing, it plays a very important role in microservice architectures.

For typical use cases, Spring Cloud provides the out of the box experiences and a sets of extensive features mentioned below:

  • Versioned and distributed configuration.
  • Discovery of service registration.
  • Service to service calls.
  • Routing.
  • Circuit breakers and load balancing.
  • Cluster state and leadership election.
  • Global locks and distributed messaging.

2. What Is Spring Boot?

Spring boot is a major topic under the umbrella of microservices interview questions.
With the new functionalities that have been added, Spring keeps getting more complex. Whenever you are starting a new project, it is mandatory to add a new build path or Maven dependencies. In short, you will need to do everything from scratch. Spring Boot is the solution that will help you to avoid all the code configurations. 

3. How Do You Override a Spring Boot Project’s Default Properties?

This can be done by specifying the properties in the application.properties file.
For example, in Spring MVC applications, you have to specify the suffix and prefix. This can be done by entering the properties mentioned below in the application.properties file.

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

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

4. Role of Actuator in Spring Boot

It is one of the most important features, which helps you to access the current state of an application that is running in a production environment. There are multiple metrics which can be used to check the current state. They also provide endpoints for RESTful web services which can be simply used to check the different metrics.

5. How Is Spring Security Implemented In a Spring Boot Application?

Minimal configuration is needed for implementation. All you need to do is add thespring-boot-starter-securitystarter in the pom.xml file. You will also need to create a Spring config class that will override the required method while extending the WebSecurityConfigurerAdapter to achieve security in the application. Here is some example code:

package com.gkatzioura.security.securityendpoints.config; 
import org.springframework.context.annotation.Configuration; 
import org.springframework.security.config.annotation.web.builders.HttpSecurity; 
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; 
public class SecurityConfig extends WebSecurityConfigurerAdapter {     
protected void configure(HttpSecurity http) throws Exception {         

6. Which Embedded Containers Are Supported by Spring Boot?

Whenever you are creating a Java application, deployment can be done via two methods:

  • Using an application container that is external.
  • Embedding the container inside your jar file.

Spring Boot contains Jetty, Tomcat, and Undertow servers, all of which are embedded.

  • Jetty – Used in a wide number of projects, Eclipse Jetty can be embedded in framework, application servers, tools, and clusters.

  • Tomcat – Apache Tomcat is an open source JavaServer Pages implementation which works well with embedded systems.

  • Undertow – A flexible and prominent web server that uses small single handlers to develop a web server.

7. What Do You Mean by End-To-End Testing of Microservices?

End-to-end testing validates all the processes in the workflow to check if everything is working as expected. It also ensures that the system works in a unified manner, thereby satisfying the business requirement.

8. What Is Semantic Monitoring?

It combines monitoring of the entire application along with automated tests. The primary benefit of Semantic Monitoring is to find out the factors which are more profitable to your business.

Semantic monitoring along with service layer monitoring approaches monitoring of microservices from a business point of view. Once an issue is detected, they allow faster isolation and bug triaging, thereby reducing the main time required to repair. It triages the service layer and transaction layer to figure out the transactions affected by availability or poor performance.

9. How Can You Set Up Service Discovery?

There are multiple ways to set up service discovery. I’ll choose the one that I think to be most efficient, Eureka by Netflix. It is a hassle free procedure that does not weigh much on the application. Plus, it supports numerous types of web applications.

Eureka configuration involves two steps – client configuration and server configuration.
Client configuration can be done easily by using the property files. In the clas spath, Eureka searches for a eureka-client.properties file. It also searches for overrides caused by the environment in property files which are environment specific.

For server configuration, you have to configure the client first. Once that is done, the server fires up a client which is used to find other servers. The Eureka server, by default, uses the Client configuration to find the peer server.

10. Why Would You Opt for Microservices Architecture?

This is a very common microservices interview question which you should be ready for! There are plenty of pros that are offered by a microservices architecture. Here are a few of them:

  • Microservices can adapt easily to other frameworks or technologies.
  • Failure of a single process does not affect the entire system.
  • Provides support to big enterprises as well as small teams.
  • Can be deployed independently and in relatively less time.

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

12. Why Do People Hesitate to Use Microservices?

I have seen many devs fumble over this question. After all, they're getting asked this question when interviewing for a microservices architect role, so acknowledging its cons can be a little tricky. Here are some good answers:

  • They require heavy investment – Microservices demand a great deal of collaboration. Since your teams are working independently, they should be able to synchronize well at all times.
  • They need heavy architecture set up – The system is distributed, the architecture is heavily involved.
  • They need excessive planning for handling operations overhead – You need to be ready for operations overhead if you are planning to use a microservices architecture.
  • They have autonomous staff selection – Skilled professionals are needed who can support microservices that are distributed heterogeneously.

13. How Does PACT Work?

PACT is an open source tool. It helps in testing the interactions between consumers and service providers. However, it is not included in the contract, increasing the reliability of the application. The consumer service developer starts by writing a test which defines a mode of interaction with the service provider. The test includes the provider’s state, the request body, and the response that is expected. Based on this, PACT creates a stub against which the test is executed. The output is stored in a JSON file.

14. Define Domain Driven Design

The main focus is on the core domain logic. Complex designs are detected based on the domain’s model. This involves regular collaboration with domain experts to resolve issues related to the domain and improve the model of the application. While answering this microservices interview question, you will also need to mention the core fundamentals of DDD. They are:

  • DDD focuses mostly on domain logic and the domain itself.
  • Complex designs are completely based on the domain’s model.
  • To improve the design of the model and fix any emerging issues, DDD constantly works in collaboration with domain experts.

That's all for Part 1. In Part 2, we'll cover 15 more great microservice interview questions to know!

microservice, microservice best practices, service discovery, spring boot microservices

Published at DZone with permission of Arnab Roy . See the original article here.

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}