dubbo configuration

1 dubbo:registry和dubbo:reference dubbo:service

dubbo:registry corresponds to a registry, each registry has an id, reference and service have a registry attribute, this attribute is the id of their corresponding registry.

1.1 properties of dubbo:registry

id, the id of the registry;

protocol, indicating whether to use zookeeper or redis, or another registry.

address, the IP address and port number of the registry.

1.2 properties of dubbo:reference

dubbo:reference is a service referenced by dubbo consumers.

Registry, get the service list from the specified registry. If it is not set, it will get the service list from all the registries and merge them.

id, does this correspond to the bean id of the service provider? It is corresponding, why should it be corresponding? Because when rpc is performed, this id should be sent, so that the bean of the corresponding service can be quickly found. Is that so? This should be the case, because it is not enough to rely on the interface, because there may be multiple implementations of the same interface.

interface, the interface of the service, this needs to correspond to the provider, this interface is generally defined in a separate api.

check, whether to check whether the service is available when dubbo starts.

version, the version of the service, this needs to be consistent with the version of the service provider.

filter, do some business-independent logic, such as remembering some log things.

1.3 properties of dubbo:service

executes, the maximum number of parallel requests per method per service.

2 dubbo:consumer和dubbo:provider

dubbo:consumer is configured for dubbo:reference default value,

dubbo:provider is the default value of dubbo:service for embryos.

 

3 About the timeout of consumer and provider

The configured timeout is based on the timeout of the consumer, that is, the service needs to return at least one result within this time. But the provider's timeout is also meaningful, because the service provider knows how long its service can return a result. Even in the case of high concurrency, a definite value should be given.

4 Why are both consumers and providers configured with load balancing

Whether the load balancing is configured on the consumer or the provider, they are essentially the same, because if the load balancing is configured on the provider side, it will be synchronized to the consumer side. Therefore, in general, load balancing is configured on the consumer side.

If load balancing is not configured on the consumer, the load balancing configured on the provider side is used by default. If the provider does not configure load balancing, the load balancing with random strategy is used by default. First set the weight, and then set the random probability and weight according to the weight. The higher the probability is.

5 dubbo:application

Application information configuration, such as the name of the current application.

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325857036&siteId=291194637
Recommended