Dubbo cluster fault tolerance and load balancing policy strategy what are? Dynamic proxy strategy?

Interview questions

dubbo cluster fault tolerance and load balancing policy strategy what are? Dynamic proxy strategy?

Interviewer psychological analysis

Deep asked it to continue, these are used dubbo must know something, you have to know the basic principles, know what the sequence of protocol, had to know the specific use dubbo when, how load balancing, high availability how, how dynamic proxies.

To put it plainly, it is to see you dubbo familiar with the unfamiliar:

  • dubbo works: service registration, registration center, consumer, agent communication, load balancing;
  • Network communication, the sequence of: dubbo protocol, a long connection, NIO, hessian serialized protocol;
  • Load balancing strategy, fault-tolerant cluster strategy, dynamic proxy policy: dubbo run up when some of the features is how to operate? How do load balancing? How do cluster fault tolerance? How to generate dynamic proxy?
  • dubbo SPI mechanism: you do not understand dubbo understand the mechanism of SPI? How to SPI-based mechanisms dubbo be extended?

Face questions analysis

dubbo load balancing strategy

random loadbalance

By default, dubbo is random load balance, that is, random call load balancing can be for different instances provider different weights set , will follow weights load balancing, weight the higher the weight the greater the distribution of traffic, generally use this default can a.

roundrobin loadbalance

This is the default if the flow evenly to hit up each machine, but if the performance of each machine is different, easily lead to poor performance of the machine load is too high. So in this case you need to adjust the weights so that the machine carrying heavy weights poor performance of smaller, less traffic number.

For chestnuts.

Students apply for machines with operation and maintenance, sometimes we are lucky, just more adequate resources company, just a group of steaming hot, just do a good job of freshly baked virtual machine configuration are high: 8 + 16G-core machine, apply to 2 station. After some time, we feel a little two machines is not enough, I went to O & M student said, "buddies, can you give me a machine", but this time only the next stage 4-core + 8G machine. I still have to.

This time may be set to two 8-core machine 16G weight of the counterweight 4, to the remaining core table 4 1 8G 2 weight machine settings.

leastactive loadbalance

This is the automatic perception that, if a worse performance machine, so fewer requests received, the less active at this time will give inactive poor performance of the machine less request .

consistanthash loadbalance

Hash algorithm consistency, the same parameters must request a provider to distribute up, provider hang time, will evenly distribute the remaining flow based on virtual node, the jitter will not be much. If you need is not random load balancing , to a class of requests to a node, it would go this consistency Hash strategy.

dubbo fault-tolerant cluster strategy

failover cluster mode

Failure automatic switching, automatic retry the other machine, the default is that this is common in the read operation. (Failure retry another machine)

Retries can be configured in the following ways:

<dubbo:service retries="2" />

or

<dubbo:reference retries="2" />

or

<dubbo:reference>

    <dubbo:method name="findFoo" retries="2" />

</dubbo:reference>

failfast cluster mode

A failure to immediately call failure, common in non-idempotency write operation, such as a new record (call fails immediately fail)

failsafe cluster mode

Ignored when an exception occurs, commonly used in the interface call is not important, such as logging.

Configuration example:

<dubbo:service cluster="failsafe" />

or

<dubbo:reference cluster="failsafe" />

failback cluster mode

Background automatic recording request failed, then the retransmission timer, the message queue more suitable for such a write.

forking cluster mode

Parallel to call multiple provider, as long as a successful return immediately. Commonly used in the real-time requirements of high reading operation, but will waste more service resources through forks = "2" to set the maximum number of parallel.

broadcacst cluster

Call one by one all the provider. Any error is a provider error (from 2.1.0  started to support version). Typically used to notify all providers such as cache or log updates the local resource information.

dubbo dynamic proxy policy

Default javassist bytecode generated dynamically created proxy class. But you can configure your own dynamic proxy policy by spi extension mechanism.

 

Guess you like

Origin blog.csdn.net/u014513171/article/details/93160819