Cluster fault tolerance
(+) (#)
|
When the cluster call fails, Dubbo provides a variety of fault tolerant schemes, which are failover retries by default. |
Each node relationship:
- The invoker here is a callable service abstraction for provider, Invoker encapsulates provider address and service interface information.
- The directory represents multiple Invoker, which can be viewed as list<invoker>, but unlike list, its value may be dynamically variable, such as a registry push change.
- Cluster disguise multiple invoker in directory as a invoker, transparent to the upper layer, the spoofing process contains the fault-tolerant logic, and after the call fails, retry the other.
- Router is responsible for selecting subsets from multiple invoker by routing rules, such as read/write separation, application isolation, etc.
- LoadBalance is responsible for selecting a specific one for this invocation from multiple Invoker, and the selected process contains the load balancing algorithm, which needs to be re-elected after the call fails.
Cluster fault Tolerant mode:
You can extend the cluster fault tolerance policy yourself, see: Cluster expansion
Failover Cluster
- Failed to automatically switch, when the failure occurs, retry the other server. Default
- Typically used for read operations, but retries can lead to longer delays.
- The number of retries can be set by retries= "2" (excluding the first time).
Failfast Cluster
- Fast failure, only one call is initiated, failure immediately error.
- Typically used for non-idempotent write operations, such as New records.
Failsafe Cluster
- Fail safe, when an exception occurs, it is ignored directly.
- Typically used to write operations such as audit logs.
Failback Cluster
- Failure auto-recovery, background record failed request, timed re-send.
- Typically used for message notification operations.
Forking Cluster
- Multiple servers are called in parallel, as long as a success is returned.
- It is often used for high-real-time read operations, but more service resources need to be wasted.
- The maximum number of parallelism can be set by forks= "2".
Broadcast Cluster
- Broadcast call all providers, call each, any one error is an error. (2.1.0 start support)
- Typically used to notify all providers to update local resource information such as cache or log.
Number of retries configured such as: (Failover cluster mode is in effect)
< dubbo:service retries = "2" /> |
Or:
< dubbo:reference retries = "2" /> |
Or:
< dubbo:reference > < dubbo:method name = "findFoo" retries = "2" /> </ dubbo:reference > |
Cluster mode configuration such as:
< dubbo:service cluster = "failsafe" /> |
Or:
< dubbo:reference cluster = "failsafe" /> |
8-dubbo cluster fault tolerance in the first Knowledge Dubbo series