Anatomy of Dubbo - Cluster Fault Tolerance

I. Introduction

When designing a system, not only should the normal logic go, but also the abnormal logic. In dubbo, when an error occurs when the service consumer invokes the service of the service provider, a variety of fault tolerance schemes are provided. The default is failover and retry.

2. Dubbo cluster fault tolerance mode

  • Failover Cluster
    retry. When the service consumer fails to call the service provider, it will automatically switch and retry other service providers. This is usually used for read operations or write operations with idempotency, with the caveat that retries incur longer delays. The number of retries (excluding the first time) can be set by retries=”2”.
  • Failfast Cluster
    fails fast. When the service consumer fails to call the service provider, an error is reported immediately upon failure. Typically used for non-idempotent write operations.

  • Failsafe Cluster failsafe
    . When an exception occurs, ignore it directly. Typically used for operations such as writing to the audit log.

  • Failback Cluster
    failures are automatically recovered. The failed request is recorded in the background and retried later according to a certain strategy. Typically used for message notification operations.

  • Forking Cluster
    invokes the services of multiple service providers in parallel, and returns as long as one succeeds. It is usually used for read operations with high real-time requirements, but it needs to waste more service resources. The maximum number of parallels can be set by forks=”2”.

  • Broadcast Cluster
    broadcast calls all service providers, call them one by one, and reports an error if any one reports an error. Typically used to notify all providers to update local resource information such as caches or logs

3. Principle

3.1 When to load the cluster fault tolerance extension implementation class

image.png

3.2 Principle of FailoverClusterInvoker

image.png

4. Summary

Dubbo itself provides rich cluster fault tolerance modes. If you have customization requirements, you can customize it according to the extension interface provided by dubbo.

Welcome everyone to join WeChat scan code to enter the knowledge planet for in-depth discussion
121、.png

Guess you like

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