The key points of microservice interviews, if you don’t understand, I advise you to learn more!

1. What is the use of WebMvcTest annotations in Spring MVC applications?

@WebMvcTest(value = ToTestController.class, secure = false):

In the case where the test target only focuses on Spring MVC components, the WebMvcTest annotation is used to unit test Spring MVC applications. In the snapshot shown above, we just want to start ToTestController. When this unit test is executed, all other controllers and maps will not be started.

2. Can you give some points about rest and microservices?

Although you can implement microservices in many ways, REST over HTTP is one way to implement microservices. REST can also be used for other applications, such as web applications, API design and MVC applications, to provide business data.

Microservices is an architecture in which all components of the system are put into separate components, which can be built, deployed, and extended separately. Certain principles and best practices of microservices help build resilient applications.

In short, you can say that REST is a medium for building microservices.

3. What are the different types of microservice testing?

When using microservices, testing becomes very complicated due to multiple microservices working together. Therefore, the test is divided into different levels.

· At the bottom, we have technology-oriented tests, such as unit tests and performance tests. These are fully automated.

· At the intermediate level, we conducted exploratory testing such as stress testing and usability testing.

· At the top level, we have very few acceptance tests. These acceptance tests help stakeholders understand and verify software functionality.

4. What do you know about Distributed Transaction?

Distributed transaction refers to any situation where a single event causes mutations in two or more separate data sources that cannot be submitted atomically. In the world of microservices, it becomes more complicated because each service is a unit of work, and most of the time multiple services must work together to make the business successful.

5. What is Idempotence and where is it used?

Idempotence is the property of being able to do something twice in such a way that the end result will remain the same, that is, as if it was done only once.

Usage: Use Idempotence in remote services or data sources so that when it receives instructions multiple times, it only processes instructions once.

6. What is a bounded context?

Bounded context is the core mode of domain-driven design. The focus of the DDD strategic design department is to deal with large models and teams. DDD deals with large models by dividing them into different bounded contexts and clarifying their interrelationships.

7. What is two-factor authentication?

Two-factor authentication enables second-level authentication for the account login process.

Insert picture description here

                                 图1: 双因素认证的表示 – 微服务访谈问题

Therefore, assuming that the user must only enter a username and password, then this is considered single-factor authentication.

8. What are the credential types for two-factor authentication?

The three types of credentials are:

Insert picture description here

                                     图 2: 双因素认证的证书类型 – 微服务面试问题

9. What is a client certificate?

A digital certificate used by the client system to send an authenticated request to a remote server is called a client certificate. Client certificates play a very important role in many mutual authentication designs, and provide a strong guarantee for the identity of the requester.

10. What is the purpose of PACT in the microservice architecture?

PACT is an open source tool that allows the interaction between test service providers and consumers to be isolated from contracts, thereby improving the reliability of microservice integration.

Usage in microservices

· Used to implement consumer-driven contracts in microservices.

· Test consumer-driven contracts between consumers and providers of microservices.

View upcoming batches

11. What is OAuth?

OAuth stands for Open Authorization Protocol. This allows access to the resource owner's resources by enabling client applications (such as third-party providers Facebook, GitHub, etc.) on the HTTP service. Therefore, you can share resources stored on one site with another site without using its credentials.

12. What is Conway's law?

"Any organization (broadly defined) that designs a system will produce a design whose structure is a copy of the organization's communication structure." – Mel Conway
Insert picture description here

                                 图 13: Conway 定律的表示 – 微服务访谈问题

The law basically tries to convey the fact that in order for the software module to work, the entire team should communicate well. Therefore, the structure of the system reflects the social boundaries of the organization that produced it.

13. What do you know about contract testing?

According to Martin Flower, contract testing is a test performed at the boundary of an external service to verify whether it meets the expected contract of the consumer service.

In addition, contract testing does not test the behavior of the service in depth. More precisely, it tests that the input & output of the service call contains the required attributes and the response delay, and the throughput is within the allowable limit.

14. What is end-to-end microservice testing?

End-to-end testing verifies that every process in the workflow is functioning properly. This ensures that the system as a whole works together and meets all requirements.

In layman's terms, you can say that end-to-end testing is a type of testing that tests everything after a certain period of time.

Insert picture description here

                                 图 14:测试层次 – 微服务面试问题

15. What is the purpose of Container in microservices?

Containers are a great way to manage microservice-based applications in order to develop and deploy them individually. You can encapsulate microservices in a container image and its dependencies, and then you can use it to roll over microservices for on-demand instances without any additional work.

Insert picture description here

                                 图 15: 容器的表示及其在微服务中的使用方式 – 微服务访谈问题

16. What is DRY in the microservice architecture?

DRY means don't repeat yourself. It basically promotes the concept of reusing code. This leads to development and shared libraries, which in turn leads to tight coupling.

17. What is a consumer-driven contract (CDC)?

This is basically a pattern for developing microservices so that they can be used by external systems. When we deal with microservices, there is a specific provider who builds it, and there are one or more consumers who use the microservices.

Usually, the provider specifies the interface in the XML document. But in a consumer-driven contract, each service consumer communicates the interface expected by the provider.

18. What is the role of Web and RESTful API in microservices?

The microservice architecture is based on a concept in which all services should be able to interact with each other to build business functions. Therefore, to achieve this, every microservice must have an interface. This makes Web API a very important enabler of microservices. RESTful API is based on the open network principle of the Web, and provides the most reasonable model for constructing the interface between the various components of the microservice architecture.

19. What do you know about semantic monitoring in microservice architecture?

Semantic monitoring, also known as comprehensive monitoring, combines automated testing with monitoring applications to detect business failure factors.

20. How do we conduct cross-functional testing?

Cross-functional testing is the verification of non-functional requirements, that is, requirements that cannot be implemented like ordinary functions.

Conclusion and follow-up

With the gradual maturity of the distributed technology stack, in recent years, more and more systems and fields have been designed with microservice architecture in the industry, including finance, e-commerce, live broadcast, logistics, marketing, procurement, manufacturing, etc., both in the Internet field and traditional field.
Recently, it is the best time to find a job. I have collected some interview questions from major manufacturers and the latest data this year (2020). The following are some screenshots of the data (all data have been integrated into documents, and pdf compressed and packaged) .
If you have a friend in need, you can click here to get information, code: qf

Insert picture description here

Guess you like

Origin blog.csdn.net/SpringBoot_/article/details/108598404