Circuit Breaker Plug-in
Overview
ROMA Connect uses circuit breakers to protect the system when performance issues occur on backend services. When the backend service of an API times out for N consecutive times or there is long latency, the circuit breaker downgrade mechanism is triggered to return an error to the API caller or forward the request to the specified backend. After the backend service recovers, the circuit breaker closes and the request becomes normal.
Parameter Description
Parameter |
Description |
---|---|
API Sharing |
When enabled, all APIs bound to the current plug-in are calculated together for circuit breaker triggering. |
Circuit Breaker Type |
Specify a circuit breaker triggering type.
|
Condition Type |
Specify a circuit breaker triggering mode.
|
Match Conditions |
This parameter is mandatory only when Circuit Breaker Type is set to Conditional downgrade. Configure the match conditions for circuit breaker triggering.
|
Time Window |
Configure the time window for circuit breaker triggering. Use this parameter together with Threshold or Min Percentage. Once the number of times or percentage when conditions are met within the time window exceeds the threshold, the circuit breaker is triggered. |
Threshold |
This parameter is mandatory only when Condition Type is set to Count. Configure the threshold for circuit breaker triggering. Use this parameter together with Time Window. Once the number of backend requests that meet the conditions within the time window reaches the threshold, the circuit breaker is triggered.
NOTE:
A circuit breaker plug-in is triggered for a single gateway component. If ROMA Connect has multiple components, the triggering for each component is determined separately. If the threshold is reached within the time window for a gateway component, requests sent to the component trigger the circuit breaker, but other gateway components still forward requests normally. An IP address indicates a gateway component. To view the number of gateway components, go to the Instance Information page of a ROMA Connect instance by clicking the instance name on the console and view the number of IP addresses in Connection Addresses. |
Min Calls |
This parameter is mandatory only when Condition Type is set to Percentage. Configure the minimum number of calls to trigger the circuit breaker. Once the total number of API calls within the time window reaches the threshold specified, the circuit breaker is triggered. |
Min Percentage |
This parameter is mandatory only when Condition Type is set to Percentage. Configure the threshold for circuit breaker triggering. Use this parameter together with Time Window. Once the percentage of backend requests that meet the conditions within the time window reaches the threshold, the circuit breaker is triggered. |
Control Duration |
Configure the duration for which the circuit breaker is open. The circuit breaker is closed when the duration reaches the value specified. |
Backend Downgrade Policy |
Specify whether to enable the backend downgrade policy.
|
Backend Policy Type |
This parameter is mandatory only when Backend Downgrade Policy is enabled. Specify the backend type to which requests will be forwarded when the circuit breaker is open.
|
Downgrade Parameter Settings |
Specify whether to enable downgrade parameter configuration. When enabled, custom rules take precedence over the default ones configured above:
|
Parameters |
Define the parameters for rule matching.
By default, the system contains the reqPath (request path) and method (request method) parameters. Click Add Parameter to add parameters. |
Rules |
Customize matching rules for the circuit breaker. Click Add Rule to add rules. The system matches rules from top to bottom. Adjust the rule priority by moving the rules up or down.
Example: You have enabled Downgrade Parameter Settings and added rules rule01 and rule02 in sequence. And you have disabled Trigger Configuration and enabled Backend Downgrade Policy for rule01, and have enabled both parameters for rule02. Analysis: The circuit breaker first checks whether the match conditions of rule01 are met. If yes, the circuit breaker opens based on the default settings because no trigger condition is defined in rule01, and the backend downgrade policy in rule01 is executed. If no, rule02 is checked. |
Script Configuration Example
{ "breaker_condition":{ "breaker_type":"timeout", "breaker_mode":"counter", "unhealthy_threshold":30, "time_window":15, "open_breaker_time":15, "unhealthy_percentage":51, "min_call_threshold":20 }, "scope":"share", "downgrade_default":{ "type":"http", "passthrough_infos":null, "func_info":null, "mock_info":null, "http_info":{ "isVpc":false, "vpc_channel_id":"", "address":"10.10.10.10", "scheme":"HTTP", "method":"GET", "path":"/demo", "timeout":5000 }, "http_vpc_info":null }, "downgrade_parameters":[ { "name":"reqPath", "type":"path", "value":"path", "disabled":true, "focused":true, "id":"92002eqbpilg6g" }, { "name":"method", "type":"method", "value":"method", "disabled":true, "focused":true, "id":"tuvxetsdqvcos8" }], "downgrade_rules":[ { "rule_name":"rule-test1", "parameters":[ "reqPath", "method" ], "match_regex":"[\"reqPath\",\"==\",\"/test\"]", "downgrade_backend":{ "type":"mock", "passthrough_infos":null, "func_info":null, "mock_info":{ "status_code":200, "result_content":"{status: ok}", "headers":[] }, "http_info":null, "http_vpc_info":null }, "breaker_condition":{ "breaker_type":"timeout", "breaker_mode":"percentage", "unhealthy_threshold":30, "time_window":15, "open_breaker_time":15, "unhealthy_percentage":51, "min_call_threshold":20 } }] }
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot