Interviewer: What is Dubbo and what are his characteristics?

hello! Hello everyone, I'm Xiaoqi, a programmer who loves to share.
Xiaoqi intends to share some techniques in a light and humorous dialogue. If you feel that you have learned something through Xiaoqi's article, then give Xiaoqi a like
article. Continue to update, you can search for [Xiaoqi JAVA Interview] on WeChat to read it for the first time, reply to [Information] and there are more benefits I have prepared for you! Reply to [Project] There are some project source codes that I have prepared for you. Reply [Resume Template] There is a resume template that I have prepared for you.

I. Introduction

I picked up the book from the last chapter. Today is the weekend. Although I don’t go to work, I have a normal weekend. Today I still lie flat on my ancestral kang.

insert image description here

Hey, when can my wife and children heat up the kang head, and now I sleep strangely cold (and I have to add more firewood). . .

Forget it, I don't want some of this to be gone, let's go with everything, if it doesn't work, let Aunt Liu tell me the matchmaking. . . Let's cook first

insert image description here

Just as I was on fire my phone suddenly rang.

Me: "Hello".

Opposite: "Hello, is this Xiao Qi?"

Me: "It's me, are you?".

Opposite: "I'm from XXX company. I saw that HR pushed me your resume. I feel pretty good. When is it convenient for you to come to the site for an interview."

Me: "It's inconvenient for on-site interviews now."

Opposite: "Okay, is it convenient for you now? Let's have an online interview now."

Me: "OK".

2. Interview

Interviewer: I see that you are proficient in Dubbo on your resume. Can you tell me what Dubbo is?

Me: Dubbo started out as an RPC framework, but now Dubbo is a Java service framework as its functions become more and more complete.

Interviewer: Well, since you said RPC, what is it?

Me: RPC is a remote procedure call. RPC is also a computer communication protocol. It can call the program of machine B from machine A, and it is as convenient as calling a local program.

Interviewer: Well, what are the characteristics of Dubbo?

Dubbo has features such as load balancing, service timeout processing, cluster fault tolerance, service degradation, local stubs, local masquerading, parameter callbacks, and asynchronous calls.

Interviewer: Well, can you tell me how Dubbo's load balancing is implemented?

Me: In Dubbo, when a consumer calls a server, it records the activity of the server. For example, there is now a consumer and two servers, A and B.

When the consumer sends a message to the A service, the consumer will record that the active of the A service will increase by 1, and when the consumer receives the corresponding result of the server A, the active of the A service will be decremented by 1.

When the consumer chooses which server to use, it is judged according to the active size of each server. First, select the active one to call.

Interviewer: Well, then tell me how to set the Dubbo service timeout. Is there anything I should pay attention to?

Dubbo can set a timeout on both the consumer and the server. The timeout of the consumer is the time from when the consumer sends a message to when the consumer receives the message.

The timeout period of the server is the time from when the server receives the message to when it is processed.

It should be noted that the time on the consumer side should be set to be longer than the time on the server side, because if the consumer side is set to 2 seconds, the server side is set to 5 seconds, and the service execution takes 3 seconds, then the consumer side must be timed out. , but this time the server does not time out and no exception will occur.

Interviewer: Well, can you talk about Dubbo's cluster fault tolerance?

Cluster fault tolerance means that the server has multiple providers, and they form a cluster. When a consumer calls the server, the server selects a provider to provide services through a load balancing strategy. When an error occurs when calling this server, Dubbo will follow up. a series of strategies.

Dubbo provides a variety of cluster fault tolerance modes.

Failover Cluster: Automatically switch on failure. When a failure occurs, retry other servers. Typically used for read operations, but retries incur longer delays. The number of retries (excluding the first time) can be set by retries="2".

Failfast Cluster: Fast failure, only one call is made, and an error is reported immediately upon failure. Usually used for non-idempotent write operations, such as adding new records.

Failsafe Cluster : Failsafe, when an exception occurs, ignore it directly. Typically used for operations such as writing to the audit log.

Failback Cluster: Automatically recover from failures, record failed requests in the background, and resend them regularly. Typically used for message notification operations.

Forking Cluster: Call multiple servers in parallel, and return as long as one succeeds. It is usually used for read operations with high real-time requirements, but it needs to waste more service resources. The maximum number of parallels can be set by forks="2".

Broadcast Cluster: Broadcast calls all providers, call them one by one, and reports an error if any one reports an error. Typically used to notify all providers to update local resource information such as caches or logs.

Interviewer: "You are not bad, when will you be able to return to Beijing for a job?"

Me: "Um... Wait, there are still many companies waiting to negotiate salary, I have to pick a suitable one."

Interviewer: "I'll give you as much as you want, come to me"

Me: "Um...then the monthly salary is 100 W."

Interviewer: "Hey, I can't hear what you said, the signal is not good..."

Me: "Hey hey hey" (beep beep beep beep beep...).

3. Summary

The relevant content here has not been sorted out, and the article will continue to be updated later, and it is recommended to collect it.

The commands involved in the article must be knocked several times like me. Only in the process of knocking can you find out whether you really master the commands.

If you think my article is not bad, please like it. In addition, you can search for [Xiaoqi JAVA Interview] on WeChat to read it as soon as possible, and reply to [Information] and there are more benefits I have prepared for you! Reply to [Project] There are some project source codes that I have prepared for you. Reply [Resume Template] There is a resume template that I have prepared for you.

Guess you like

Origin blog.csdn.net/weixin_44096133/article/details/125074473