# Overview

The default rule function is used to configure global circuit breaker rules, including service default configuration. The circuit breaker policy supports exception ratio and number of exceptions. The recovery strategy supports attempted recovery, gradual recovery, and immediate recovery, and supports customized response messages after triggering circuit breaker. The default rule functionality is introduced below.

##Default rules

Menu location: Circuit Breaker Management > Default Rules. Click the menu to enter the default rule viewing page, as shown in the figure.

manager_degrade_rule_default_query

You can view the current global circuit breaker rules on the page. Click the Edit button to enter the editing page, as shown in the figure.

manager_degrade_rule_default_edit_1

manager_degrade_rule_default_edit_2

# Service default configuration

The default configuration of the service performs circuit breaker control on each service of the entire node (the front-end service name in the routing configuration). When the service default configuration is enabled and a request for a service on a single node meets the circuit breaker conditions, it will be circuit breaker.

After checking the Enable option, the fuse configuration item automatically appears, as shown in the figure.

manager_degrade_rule_default_service_config_1

Circuit breaker strategy: Optional Abnormal ratio|Number of exceptions, required;

Proportion threshold: This item appears when the circuit breaker policy selects Abnormal proportion. The abnormal request proportion threshold exceeds this value and triggers circuit breaker. The default value is 0.5, required;

Number of exceptions: This item appears when the circuit breaker policy selects the number of exceptions. The number of abnormal requests exceeds this value and triggers circuit breaker. The default value is 50, which is required;

manager_degrade_rule_default_service_config_2

Minimum number of requests: When the number of requests is less than this value, the circuit breaker will not be interrupted even if the abnormal request exceeds the threshold. The default value is 100, which is required;

Circuit breaker duration: The length of time the request is circuit breaker after triggering the circuit breaker. The default value is 10, required;

Statistical duration: the statistical duration of the circuit breaker, the default value is 10, required;

Recovery strategy: Optional Try recovery|Gradual recovery|Recover immediately, required;

  • Attempt to recover: After the circuit breaker ends, a request is allowed to enter. When the request is successful, the service is restored. If the request fails, it will immediately enter the next circuit breaker duration;

  • Gradual recovery: After the circuit breaker is over, requests are gradually released in proportion to the recovery time. For example, if the recovery time is configured to be 5 seconds, 20% of the requests will be released in the first second, 40% of the requests will be released in the second second,..., Chapter 100% of requests will be passed in 5 seconds;

  • Immediate recovery: services will be restored immediately after the circuit breaker ends and all requests will be allowed;

Recovery duration: This item appears when Recovery Strategy selects Gradual Recovery. The recovery duration after the circuit breaker ends. The default value is 5 and is required;

After submission, global service circuit breaker can be enabled.

# Customized circuit breaker response

After configuring the circuit breaker response ContentType and circuit breaker response message, the client will obtain the configured response message when the circuit breaker is triggered. The configuration is as shown in the figure.

manager_degrade_rule_default_response_config