Dubbo Service Cluster Fault tolerant configuration (iv)

Source: Internet
Author: User
Official website User guide: http://dubbo.io/User+Guide-zh.htm
1.DUBBO Service Cluster deployment

Take some of the services in the Lite payment system as an example:

Customer Service: Pay-service-user Trading Service: Pay-service-trade 2.Dubbo Service cluster Fault tolerant configuration--Cluster fault tolerant mode:

is required: Optional

Default value: Failover

Role: Performance Tuning

Cluster mode: Optional: failover/failfast/failsafe/failback/forking

Compatibility: 2.0.5 or above version 1, Failover Cluster: Failure Auto Switch

Failed to automatically switch, when the failure occurs, retry the other server. (the default) is typically used for read operations, but retries result in a longer delay. The number of retries can be set by retries= "2" (excluding the first time).

<dubbo:service retries= "2"/> or:

<dubbo:referenceretries= "2"/>

Or:

<dubbo:reference>

<dubbo:methodname= "Findfoo" retries= "2"/> </dubbo:reference> 2, Failfas tcluster: Fast failure

Fast failure, only one call is initiated, failure immediately error.

Typically used for non-idempotent write operations, such as New records.

<dubbo:service cluster= "FailFast"/> Or:

<dubbo:referencecluster= "FailFast"/> 3, Failsafe Cluster: Fail safe

Fail safe, when an exception occurs, it is ignored directly.

Typically used to write operations such as audit logs.

<dubbo:service cluster= "failsafe"/> Or:

<dubbo:referencecluster= "Failsafe"/>
4, Failbackcluster: Failure Auto Recovery

Failure auto-recovery, background record failed request, timed re-send. Typically used for message notification operations.

<dubbo:service cluster= "failback"/> Or:

<dubbo:referencecluster= "failback"/>
5. Forkingcluster: Parallel Call

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".

<dubbo:servicecluster= "Forking"/>

Or:

<dubbo:referencecluster= "forking"/> Dubbo Service cluster Fault tolerant configuration--Cluster fault tolerance mode: Policy Maturity


3. Check at startup

Dubbo the provincial capital at startup, check if dependent services are available, throw exceptions when not available, prevent spring initialization from completing so that problems can be detected early, and default check=true.
If your spring container is lazy-loaded, or if you defer referencing the service through API programming, turn off check, otherwise the service is temporarily unavailable, throws an exception, gets a null reference, and, if check=false, always returns a reference, which can be automatically connected when the service resumes.

Checks can be turned off by check= "false", for example, when testing, some services do not care, or there is a cyclic dependency, a party must start first.

Turn off the startup check for a service: (No provider times wrong)

< Dubbo:reference interface = "Com.foo.BarService" check = "false"/>

Turn off check for all services at startup: (no provider times wrong)

< Dubbo:consumer check = "false"/>

Shut Down registry startup check: (Failed to register for subscription times wrong)

< Dubbo:registry check = "false"/>

Can also be configured with dubbo.properties: dubbo.properties

Dubbo.reference.com.foo.barservice.check=false Dubbo.reference.check=false Dubbo.consumer.check=false Dubbo.registry.check=false

You can also use the-D parameter:

Java-ddubbo.reference.com.foo.barservice.check=false Java-ddubbo.reference.check=false Java- Ddubbo.consumer.check=false Java-ddubbo.registry.check=false
Note the difference
Dubbo.reference.check=false, the check value of all reference is forced to change, even if there is a declaration in the configuration, it will be overwritten. Dubbo.consumer.check=false, which is the default value for setting check, if there is an explicit declaration in the configuration, such as: <dubbo:reference check= "True"/>, is not affected. Dubbo.registry.check=false, the previous two refers to the success of the subscription, but the provider list is empty whether the error, if the registration of the subscription failed, also allow the start, need to use this option, will be retried in the background timed.

The reference defaults to deferred initialization, which is initialized only if the reference is injected into another bean or obtained by Getbean ().
If hunger loading is required, that is, no one is referenced and generates a dynamic agent immediately, you can configure:

< Dubbo:reference interface = "Com.foo.BarService" init = "true"/>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.