Microservices Architecture is very popular, in-demand as they are scalable. From an experienced engineer, it’s expect to know microservice design. In the interview, companies ask microservices interview questions to check your understanding of them. Here are the top interview questions for microservices.
Questions and Answers : Microservices Interview Questions
Here are the top Microservices interview questions
What is Microservice architecture?
The interview mostly started by asking this, what you know about Microservice Architecture?
Microservices, also known as the microservice architecture – is an architectural style that structures an application as a collection of services that are
◉ Loosely coupled
◉ Highly maintainable and testable
◉ Independently deployable
◉ Organized around business capabilities
◉ Owned by a small team
Microservice architecture is an architectural style that structures the application as a set of services that are organized around business capabilities.
What is monolithic architecture?
◉ A monolithic architecture is the traditional unified model for the design of a software program.
◉ Monolithic software is designed to be self-contained; components of the program are interconnected and interdependent. In a tightly coupled architecture, each component and its associated components must be present in order for code to be executed or compiled.
What are advantages of monolithic architecture?
◉ Simple to develop.
◉Simple to test. For example, you can implement end-to-end testing by simply launching the application and testing the UI with Selenium.
◉ Simple to deploy. You just have to copy the packaged application to a server.
◉ Simple to scale horizontally by running multiple copies behind a load balancer.
What are the disadvantages of monolithic architecture?
◉ Application is too large and complex to fully understand and make changes fast and correctly.
◉ The size of the application can slow down the start-up time.
◉ You must redeploy the entire application on each update.
◉ Extensive manual test ing, as the impact can break any module.
◉ Continuous deployment is difficult.
◉ Reliability, one module failure can impact others and result in application failure.
◉ Monolithic applications have a barrier to adopting new technologies.
◉ Scalability is difficult as complete applications need to scale, and can’t make a module scalable.Advertisement
What are Protocols and Standards used for communication between Microservices?
So, after the larger considerations of microservice-to-microservice communications –
◉ Use HTTP/REST (synchronous) communication for services outside of the internal microservices structure. The HTTP/REST communication is ideal for external requests, as it’s built to easily handle items like real-time interactions from a client.
◉ Use AMQP (asynchronous) for communication methods within the internal microservices structure.
What is Spring Cloud?
Spring Cloud is a new project in the spring.io family with a set of components that can be used to implement our operations model. To a large extent Spring Cloud 1.0 is based on components from Netflix OSS. Spring Cloud integrates the Netflix components in the Spring environment in a very nice way using auto configuration and convention over configuration similar to how Spring Boot works.
What are the common tools and components of Spring Cloud?
Here is the list of commonly used components by Spring Cloud –
How Spring Cloud discover all available microservices?
Netflix Eureka (Service Discovery Server), allows microservices to register themselves at runtime as they appear in the system landscape. It’s like a directory, where all the microservices must be registered, in order to communicate with each other.
What is role of Netflix Ribbon in Spring Cloud?
Netflix Ribbon, Dynamic Routing and Load Balancer Netflix Ribbon can be used by service consumers to lookup services at runtime. Ribbon uses the information available in Eureka to locate appropriate service instances. If more than one instance is found, Ribbon will apply load balancing to spread the requests over the available instances. Ribbon does not run as a separate service but instead as an embedded component in each service consumer.
How can we manage security across all the microservices available in Spring Cloud?
Netflix Zuul, Edge Server Zuul is (of course) our gatekeeper to the outside world, not allowing any unauthorized external requests to pass through. Zulu also provides a well-known entry point to the microservices in the system landscape. Using dynamically allocated ports is convenient to avoid port conflicts and to minimize administration but it makes it of course harder for any given service consumer. Zuul uses Ribbon to look up available services and routes the external request to an appropriate service instance. In this blog post, we will only use Zuul to provide a well-known entry point, leaving the security aspects for coming blog posts.
What are the embedded containers supported by Spring Boot?
Tomcat- Apache Tomcat, an open-source JavaServer Pages implementation
Undertow- A central and flexible web server that develops a web server using small single handlers.
Jetty- Eclipse Jetty can be embedded in application servers, tools, framework, and clusters in a vast number of projects Apache Tomcat, an open-source JavaServer Pages implementation.
What is serverless deployment strategy of Microservices deployment?
In serverless deployment, the service is compressed and packaged as a ZIP file and uploaded to the Lambda function(a stateless service that can run enough microservices automatically to handle all requests).
How to debug microservices?
Spring Boot has inbuild support for Java Util Logging. It is usually pre-configured as console output. logging.level can be configured like below in the application.properties file.
What does idempotent mean in microservices?
For a microservice to be idempotent it must produce the same output if given the same inputs. Or in other words, it is idempotent if its logic can be invoked more than once and produce only one side effect.
What tools are used to monitor Spring Cloud microservices?
There are three monitoring tools are as follows:
Hystrix dashboard, Eureka admin dashboard, and Spring boot admin dashboard, Spring Boot Actuator
How Microservices architecture improved fault-isolation?
Microservices also offer improved fault isolation whereby in the case of an error in one service the whole application doesn’t necessarily stop functioning. When the error is fixed, it can be deployed only for the respective service individually instead of redeploying an entire application.
What Are the Design Patterns to Ensure Service Resiliency?
◉ Circuit Breaker Pattern (You can use some popular third-party libraries to implement circuit breaking in your application, such as Polly and Hystrix)
◉ Retry Design Pattern
◉ Timeout Design Pattern
What is Spring Boot Actuator? | What it use of Spring Boot Actuator?
Spring Boot Actuator is the umbrella of the Spring Boot Framework. It’s useful for monitor and manage the Spring Boot application. It contains the actuator endpoints and their status. The actuator is mainly used to expose operational information about the running application — health, metrics, info, dump, env, etc. It uses HTTP endpoints or JMX beans to enable us to interact with them. Once this dependency is on the classpath, several endpoints are available for us out of the box.