A, zookeeper downtime
zookeeper registration center downtime, you can also consume services exposed dubbo
Robustness:
- Monitoring center shoot down does not affect the use, but the loss of part of the sampling data
- After the database dawdle away, we can still provide service registry list queries by caching, but you can not register the new service
- Registry peer cluster, after Renyiyitai dang off, will automatically switch to another
- After shoot down all the registry, service providers and service consumers can still communicate through a local cache
- Service provider stateless, after Renyiyitai shoot down, does not affect
- After all the service providers dawdle away, will not be able to use the service consumer applications, and unlimited reconnection waiting for service providers recovery
Two, dubbo Direct
Development and testing environment, usually need to bypass the registration center, only testing service provider designated. In this case, you may need direct point to point connection, the service provider will ignore list provider registered provider. A configuration of the interface point, does not affect the B interface to get a list from the registry.
2.1 with xml configuration
<dubbo:reference id="xxxService" interface="com.alibaba.xxx.XxxService" url="dubbo://localhost:20890" />
2.2 Configuration -d
Add the -D parameter mapping service address to the JVM startup parameters:
java -Dcom.alibaba.xxx.XxxService=dubbo://localhost:20890
2.3 .properties configuration file (Please refer to the examiner network)
Three, dubbo load balancing in a cluster configuration
dubo provides a number of strategies used to balance the cluster load balancing, these strategies default random
.
3.1 Random LoadBalance random load balancing
- Mess, according to the weights set to random probability.
- The probability of collisions in a high portion, but the larger call volume, the more evenly distributed. When using heavy weights based on the probability distribution is the same, which also helps to dynamically adjust the right provider of weight.
3.2 the RoundRobin LoadBalance polling Load Balancing
- Round co-advisor barrels, use weight to determine robin cycle rate.
- Flow to slow the provider may cause request accumulation, for example, if there is one provider at a very slow speed to process the request, but it is still effective, which means it can receive requests normally. According to Roundrobin strategy, users will continue to send a request to a predetermined speed providers, do not know the poor state suppliers. Finally, we will get a lot of requests on this unhealthy provider.
3.3 LeastActive LoadBalance least active load balancing
- The least active activity based on a stochastic mechanism,
actives
means consumers but the numbers have not yet returned request has been sent. - Slower provider will receive fewer requests, the provider because slower higher
actives
.
3.4 ConsistentHash LoadBalance continuous hash load balancing
- Request consistency Hash, the same parameters are always sent to the same provider.
- When a station linked to the provider, the original request sent to the provider, based on the virtual node, in equal shares to other providers, will not cause dramatic changes. Algorithms See: http: //en.wikipedia.org/wiki/Consistent_hashing
- By default only the Hash first argument, if you want to modify, configure <dubbo: parameter key = "hash.arguments" value = "0,1" />
- 160 parts by default virtual node, if you want to modify, configure <dubbo: parameter key = "hash.nodes" value = "320" />
3.5 Configuration
3.5.1 Server service levels
<dubbo:service interface="..." loadbalance="roundrobin" />
3.5.2 Customer Service Level
<dubbo:reference interface="..." loadbalance="roundrobin" />
3.5.3 server methods class
<dubbo:service interface="..."> <dubbo:method name="..." loadbalance="roundrobin"/> </dubbo:service>
3.5.4 client class method
<dubbo:reference interface="..."> <dubbo:method name="..." loadbalance="roundrobin"/> </dubbo:reference>
Fourth, service degradation
4.1 What is a Service downgraded
When the server pressure surge, according to the actual business situation and flow of some services and pages do not deal with or have easy ways to change the policy process, freeing server resources to ensure the normal operation of the core transaction or efficient operation.
Service may be temporarily shielded by non-critical service degradation, and return policies defined for it
Dynamic configuration rules will be published 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"));
-
Configuration
mock=force:return+null
This means that all calls to the service will have a direct return NULL value, without remote call. Commonly used to reduce the impact of certain non-critical slow service. -
In addition, you can also change the configuration to
mock=fail:return+null
after the call fails, you'll get a null value. Remote user attempts to call, if the call is successful, will get real results; If the call fails, a null value will be obtained. Commonly used to tolerate certain non-critical services.
Five, fault-tolerant cluster
When a cluster call fails, dubo offers a variety of fault-tolerant solutions, the default Failover Cluster (failover retry) .
5.1 fault-tolerant cluster mode
1.Failover Cluster
Automatic switching failure when a failure occurs, retry other servers. Usually used for read operations, but retry will bring a longer delay. Through retries = "2" to set the number of retries (excluding the first).
Number again re-arranged as follows:
<dubbo:service retries="2" />
or
<dubbo:reference retries="2" />
or
<dubbo:reference> <dubbo:method name="findFoo" retries="2" /> </dubbo:reference>
2.Failfast Cluster
Quick failure, only to initiate a call immediately fails error. Write operations commonly used in non-idempotent nature, such as the new record.
3.Failsafe Cluster
Security failure, abnormal, direct ignored. Typically operable to write audit logs.
4.Failback Cluster
Automatic recovery fails, background records failed request, the retransmission timer. Typically a message notifying operation.
5.Forking Cluster
Call multiple servers in parallel, that is as long as a successful return. Typically used for higher real-time requirements of a read operation, but more services need to waste resources. May = "2" to set the maximum number of parallel through the forks.
6.Broadcast Cluster
Calling all broadcast providers, one by one call, Renyiyitai error is an error. Typically used to notify all providers such as cache or log updates the local resource information.
5.2 Cluster-Mode Configuration
Provides services in the following examples and consumers cluster configuration mode
<dubbo:service cluster="failsafe" />
or
<dubbo:reference cluster="failsafe" />