Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the Dubbo load balancing strategy?

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces "what is the Dubbo load balancing strategy". In the daily operation, I believe many people have doubts about what the Dubbo load balancing strategy is. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts about "what is the Dubbo load balancing strategy?" Next, please follow the editor to study!

1. Zookeeper downtime zookeeper downtime

Dubbo can achieve full zookeeper downtime, and consumers of services can still consume provider services.

Can still be accessed through the local cache.

Dubbo direct connection

You can connect directly without a registry.

Second, load balancing dubbo load balancing strategy

In cluster load balancing, Dubbo provides a variety of balancing strategies, and the default is random random call.

Random LoadBalance

Random, set random probability by weight.

The probability of collision on a section is high, but the larger the amount of adjustment is, the more uniform the distribution is, and it is also more uniform after using the weight according to probability, which is beneficial to dynamically adjust the weight of the provider.

RoundRobin LoadBalance

Polling, setting the polling rate according to the weight after the convention.

There is a problem of slow provider accumulating requests, for example, the second machine is slow, but it doesn't hang up, it gets stuck when the request is transferred to the second machine, and over time, all requests are stuck on the second machine.

LeastActive LoadBalance

The minimum number of active calls, the random number of the same active number, and the active number refers to the difference in count before and after the call.

Causes slower providers to receive fewer requests, because the slower the provider, the greater the difference in count before and after invocation.

ConsistentHash LoadBalance

Consistent Hash, requests with the same parameters are always sent to the same provider.

When a provider hangs up, the request originally sent to that provider, based on the virtual node and spread equally to other providers, will not cause drastic changes.

For the algorithm, see: http://en.wikipedia.org/wiki/Consistent_hashing

By default, only the first parameter Hash. If you want to modify it, please configure the

160 virtual nodes are used by default. If you want to modify them, please configure

III. Service degradation

You can temporarily shield a non-critical service with an error through the service downgrade function [1], and define the return policy after the downgrade.

Write dynamic configuration override rules to the registry:

RegistryFactory registryFactory = ExtensionLoader.getExtensionLoader (RegistryFactory.class). GetAdaptiveExtension ()

Registry registry = registryFactory.getRegistry (URL.valueOf ("zookeeper://10.20.153.10:2181"))

Registry.register (URL.valueOf ("override://0.0.0.0/com.foo.BarService?category=configurators&dynamic=false&application=foo&mock=force:return+null"))

Where:

Mock=force:return+null means that all method calls to the service by the consumer directly return the null value and do not initiate remote calls. Used to shield the impact on the caller when unimportant services are not available.

It can also be changed to mock=fail:return+null to indicate that the consumer's method call to the service returns a null value without throwing an exception after a failure. Used to tolerate the impact on callers when unimportant services are unstable.

4. The number of fault-tolerant retries in the cluster integrates hystrix

Open comment

@ EnableHystrix org.springframework.cloud spring-cloud-starter-netflix-hystrix 2.2.3.RELEASE service provider

Consumer

At this point, the study of "what is the Dubbo load balancing strategy" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report