Java Spring Recruitment Interview Question Answer Series: How Dubbo Works

1 Interview questions

  • Tell me about the working principle of dubbo?
  • Can the communication be continued after the registration center is hung up?
  • Tell me about the process of an rpc request?

2 Test site analysis

MQ, ES, Redis, Dubbo, come up to ask you some questions, principles (kafka high-availability architecture principle, es distributed architecture principle, redis thread model principle, Dubbo working principle), some of the production environment may encounter Problems (the production environment may encounter some problems after each technology is introduced), system design (design MQ, design search engine, design a cache, design rpc framework)

Of course, for example, hard interviewers, deadlocks, combined with project deadlock details, Baidu (in-depth bottom layer, basic), Ali (combined project deadlock details, with deep technical bottom layer), Xiaomi (data structure and algorithm).

Now that we have started to talk about distributed systems, we naturally focus on talking about dubbo first. After all, dubbo is the rpc framework standard for distributed systems in most companies at present, and a complete set of microservice architecture can also be built based on dubbo. But you need to develop it yourself.

Of course, spring cloud started to be very popular last year. Now a large number of companies have begun to turn to spring cloud. After all, spring cloud is a family-style bucket of micro-service architecture. But because many companies are still using dubbo, dubbo will definitely be the focus of the current interview. Moreover, dubbo has now restarted the open source community for maintenance, and it should still have a certain market and position in the future.

Now that we talk about dubbo, we must start with the principle of dubbo. You first talk about the architect of dubbo that supports rpc distributed calls, and then talk about how an rpc request dubbo is done for you, right?

3 Detailed

3.1 Working principle of dubbo

The first layer: service layer, interface layer, for service providers and consumers to achieve the
second layer: config layer, configuration layer, mainly the
third layer for various configurations of dubbo : proxy layer, service proxy layer, Transparently generate the client's stub and the skeleton of the service ticket. The
fourth layer: registry layer, service registration layer, responsible for service registration and discovery. The
fifth layer: cluster layer, cluster layer, which encapsulates the routing and load balancing of multiple service providers. Multiple instances are combined into one service. The
sixth layer: monitor layer, monitoring layer, which monitors the number of calls and call time of the rpc interface. The
seventh layer: protocol layer, remote call layer, encapsulation of rpc calls.
Layer eight: exchange layer, information Exchange layer, package request response mode, synchronous to asynchronous
layer 9: transport layer, network transmission layer, abstract mina and netty as a unified interface
layer 10: serialize layer, data serialization layer

3.1.1 Work process:

1) In the first step, the provider registers with the registry.
2) In the second step, the consumer subscribes to the service from the registry, and the registry will notify the consumer of the registered service.
3) In the third step, the consumer calls the provider.
4) In the fourth step, the consumer Asynchronously notify the monitoring center of both the provider and the provider

3.2 Can the communication be continued after the registration center is hung up?

Yes, because the consumer will pull the provider’s address and other information to the local cache when initializing, so the registry can continue to communicate after hanging up

Guess you like

Origin blog.csdn.net/weixin_43314519/article/details/112446640