Microservices Interview Questions

Ace your homework & exams now with Quizwiz!

What are the challenges you face while working Microservice Architectures?

- Automate the Components: Difficult to automate because there are a number of smaller components. So for each component, we have to follow the stages of Build, Deploy and, Monitor. - Perceptibility: Maintaining a large number of components together becomes difficult to deploy, maintain, monitor and identify problems. It requires great perceptibility around all the components. - Configuration Management: Maintaining the configurations for the components across the various environments becomes tough sometimes. - Debugging: Difficult to find out each and every service for an error. It is essential to maintain centralized logging and dashboards to debug problems.

List down the advantages of Microservices Architecture.

- Independent Development: All microservices can be easily developed based on their individual functionalityIndependent - DeploymentBased: on their services, they can be individually deployed in any application -Fault Isolation: Even if one service of the application does not work, the system still continues to function - Mixed Technology Stack: Different languages and technologies can be used to build different services of the same application - Granular Scaling: Individual components can scale as per need, there is no need to scale all components together

What do you know about Microservices?

- Microservices, aka Microservice Architecture, is an architectural style that structures an application as a collection of small autonomous services, modeled around a business domain. - In layman terms, you must have seen how bees build their honeycomb by aligning hexagonal wax cells. - They initially start with a small section using various materials and continue to build a large beehive out of it. - These cells form a pattern resulting in a strong structure which holds together a particular section of the beehive. - Here, each cell is independent of the other but it is also correlated with the other cells. - This means that damage to one cell does not damage the other cells, so, bees can reconstruct these cells without impacting the complete beehive.

What is the difference between Monolithic, SOA and Microservices Architecture?

- Monolithic Architecture is similar to a big container wherein all the software components of an application are assembled together and tightly packaged. - A Service-Oriented Architecture is a collection of services which communicate with each other. The communication can involve either simple data passing or it could involve two or more services coordinating some activity. - Microservice Architecture is an architectural style that structures an application as a collection of small autonomous services, modeled around a business domain.

What is Domain Driven Design?

- focus on core domain logic - finds complex design on models of the domain - constantly collaborate with domain experts to improve application model and to resolve domain related issues

Why there is a need for Domain Driven Design (DDD)?

- mapping the domain - reduced complexity - testability - maintainability - knowledge rich design - bring business and service together - context focused - ubiquitous language

What are the types of credentials of Two Factor Authentication?

- something you know ex:PIN, password, pattern - something you have ex:ATM card, phone, or OTP - something you are ex:biometric fingerprint or voice print

What are the best practices to design Microservices?

1. Seperate data source for each Microservice 2. Keep code at a similar level of maturity 3. Seperate build fo reach Microservice 4. Deploy into containers 5. Test servers as stateless

What is the use of WebMvcTest annotation in Spring MVC applications?

@WebMvcTest(value = ToTestController.class, secure = false); WebMvcTest annotation is used for unit testing Spring MVC Applications in cases where the test objective is to just focus on Spring MVC Components. In the snapshot shown above, we want to launch only the ToTestController. All other controllers and mappings will not be launched when this unit test is executed.

How does Microservice Architecture work?

A microservice architecture has the following components: Clients - Different users from various devices send requests. Identity Providers - Authenticates user or clients identities and issues security tokens. API Gateway - Handles client requests. Static Content - Houses all the content of the system. Management - Balances services on nodes and identifies failures. Service Discovery - A guide to find the route of communication between microservices. Content Delivery Networks - Distributed network of proxy servers and their data centers. Remote Service - Enables the remote access information that resides on a network of IT devices.

What is the role of Web, RESTful APIs in Microservices?

A microservice architecture is based on a concept wherein all its services should be able to interact with each other to build a business functionality. So, to achieve this, each microservice must have an interface. This makes the web API a very important enabler of microservices. Being based on the open networking principles of the Web, RESTful APIs provide the most logical model for building interfaces between the various components of a microservice architecture.

Can we create State Machines out of Microservices?

As we know that each Microservice owning its own database is an independently deployable program unit, this, in turn, lets us create a State Machine out of it. So, we can specify different states and events for a particular microservice. For Example, we can define an Order microservice. An Order can have different states. The transitions of Order states can be independent events in the Order microservice.

What is Bounded Context?

Bounded Context is a central pattern in Domain-Driven Design. It is the focus of DDD's strategic design section which is all about dealing with large models and teams. DDD deals with large models by dividing them into different Bounded Contexts and being explicit about their inter-relationships.

What is the use of Container in Microservices?

Containers are a good way to manage microservice based application to develop and deploy them individually. You can encapsulate your microservice in a container image along with its dependencies, which then can be used to roll on-demand instances of microservice without any additional efforts required.

What do you mean by Continuous Integration (CI)?

Continuous Integration (CI) is the process of automating the build and testing of code every time a team member commits changes to version control. This encourages developers to share code and unit tests by merging the changes into a shared version control repository after every small task completion.

What is DRY in Microservices architecture?

DRY stands for Don't Repeat Yourself. It basically promotes the concept of reusing the code. This results in developing and sharing the libraries which in turn result in tight coupling.

What are the features of Microservices?

Decoupling - Services within a system are largely decoupled. So the application as a whole can be easily built, altered, and scaled Componentization - Microservices are treated as independent components that can be easily replaced and upgraded Business Capabilities - Microservices are very simple and focus on a single capability Autonomy - Developers and teams can work independently of each other, thus increasing speed Continous Delivery - Allows frequent releases of software, through systematic automation of software creation, testing, and approval Responsibility - Microservices do not focus on applications as projects. Instead, they treat applications as products for which they are responsible Decentralized Governance - The focus is on using the right tool for the right job. That means there is no standardized pattern or any technology pattern. Developers have the freedom to choose the best useful tools to solve their problems Agility - Microservices support agile development. Any new feature can be quickly developed and discarded again

What do you understand by Distributed Transaction?

Distributed Transaction is any situation where a single event results in the mutation of two or more separate sources of data which cannot be committed atomically. In the world of microservices, it becomes even more complex as each service is a unit of work and most of the time multiple services have to work together to make a business successful.

What is the purpose of Docker?

Docker provides a container environment that can be used to host any application. In this, the software application and the dependencies which support it are tightly-packaged together. So, this packaged product is called a Container and since it is done by Docker, it is called Docker container!

What do you know about Spring Boot?

It's a knows fact that spring has become more and more complex as new functionalities have been added. If you have to start a new spring project, then you have to add build path or add maven dependencies, configure application server, add spring configuration. So everything has to be done from scratch. Spring Boot is the solution to this problem. Using spring boot you can avoid all the boilerplate code and configurations. So basically consider yourself as if you're baking a cake spring is like the ingredients that are required to make the cake and spring boot is the complete cake in your hand.

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

What is OAuth?

OAuth stands for open authorization protocol. This allows accessing the resources of the resource owner by enabling the client applications on HTTP services such as third-party providers Facebook, GitHub, etc. So with this, you can share resources stored on one site with another site without using their credentials.

What is the use of PACT in Microservices architecture?

PACT is an open source tool to allow testing interactions between service providers and consumers in isolation against the contract made so that the reliability of Microservices integration increases. Usage in Microservices: - Used to implement Consumer Driven Contract in Microservices. - Tests the consumer-driven contracts between consumer and provider of a Microservice.

What are the pros and cons of Microservice Architecture?

Pros of Microservice Architecture - Freedom to use different technologies - Each microservices focuses on single capability - Supports individual deployable units - Allow frequent software releases - Ensures security of each service - Mulitple services are parallelly developed and deployed Cons of Microservice Architecture - Increases troubleshooting challenges - Increases delay due to remote calls - Increased efforts for configuration and other operations - Difficult to maintain transaction safety - Tough to track data across various boundaries - Difficult to code between services

Can you give a gist about Rest and Microservices?

REST Though you can implement microservices in multiple ways, REST over HTTP is a way to implement Microservices. REST is also used in other applications such as web apps, API design, and MVC applications to serve business data. Microservices Microservices is an architecture wherein all the components of the system are put into individual components, which can be built, deployed, and scaled individually. There are certain principles and best practices of Microservices that help in building a resilient application. In a nutshell, you can say that REST is a medium to build Microservices.

What is REST/RESTful and what are its uses?

Representational State Transfer (REST)/RESTful web services are an architectural style to help computer systems communicate over the internet. This makes microservices easier to understand and implement. Microservices can be implemented with or without RESTful APIs, but it's always easier to build loosely coupled microservices using RESTful APIs.

What are the key differences between SOA and Microservices Architecture?

SOA - Follows "share-as-much-as-possible" architecture approach - Importance is on business functionality reuse - They have common governance and standards - Uses Enterprise Service bus (ESB) for communication - They support multiple message protocols - Multi-threaded with more overheads to handle I/O - Maximizes application service reusability - Traditional Relational Databases are more often used - A systematic change requires modifying the monolith - DevOps / Continuous Delivery is becoming popular, but not yet mainstream Microservices - Follows "share-as-little-as-possible" architecture approach - Importance is on the concept of "bounded context" - They focus on people collaboration and freedom of other options - Simple messaging system - They use lightweight protocols such as HTTP/REST etc. - Single-threaded usually with the use of Event Loop features for non-locking I/O handling - Focuses on decoupling - Modern Relational Databases are more often used - A systematic change is to create a new service - Strong focus on DevOps / Continuous Delivery

What is an actuator in Spring boot?

Spring Boot actuator provides restful web services to access the current state of running an application in the production environment. With the help of actuator, you can check various metrics and monitor your application.

What is Spring Cloud?

Spring Cloud provides tools for developers to quickly build some of the common patterns in distributed systems (e.g. configuration management, service discovery, circuit breakers, intelligent routing, leadership election, distributed sessions, cluster state).

What is Cohesion?

The degree to which the elements inside a module belong together is said to be cohesion.

What is Coupling?

The measure of the strength of the dependencies between components is said to be coupling. A good design is always said to have High Cohesion and Low Coupling.

What is Conway's law?

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. So suppose a user has to enter only username and password, then that's considered a single-factor authentication.

What problems are solved by Spring Cloud?

While developing distributed microservices with Spring Boot we face few issues which are solved by Spring Cloud. The complexity associated with distributed systems - This includes network issues, Latency overhead, Bandwidth issues, security issues. Ability to handle Service Discovery - Service discovery allows processes and services in a cluster to find each other and communicate. Solved redundancy issues - Redundancy issues often occur in distributed systems. Load balancing - Improves the distribution of workloads across multiple computing resources, such as a computer cluster, network links, central processing units. Reduces performance issues - Reduces performance issues due to various operational overheads.

What are different types of Tests for Microservices?

While working with microservices, testing becomes quite complex as there are multiple microservices working together. So, tests are divided into different levels. - At the bottom level, we have technology-facing tests like- unit tests and performance tests. These are completely automated. - At the middle level, we have tests for exploratory testing like the stress tests and usability tests. - At the top level, we have acceptance tests that are few in number. These acceptance tests help stakeholders in understanding and verifying software features.

What is an Idempotence and where it is used?

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


Related study sets

CH.7 ENERGY BALANCE & WEIGHT CONTROL

View Set

SW 1: white spaces & 4 box business models

View Set

Physics 10: Velocity, Acceleration, and Newton's Laws

View Set

Chapter 14 Fitness: Physical Activity, Nutrients, and Body Adaptations

View Set

Networks and the Internet unit test ******

View Set