This article is participating in the “Digitalstar Project” to win a creative gift package and challenge the creative incentive money.

After installing the integration above, you also need to edit the fuse and degrade rules on the Sentinel page. The following describes common configuration rules.

1. The flow control

1. Quick use

Click Flow Control on the interface and set the single-machine threshold (concurrency per second). Do not change it for the source.Using Postman tests, errors are reported after multiple clicks.

2. Configuration details (skip without special requirements)

1. Threshold type

  1. Number of threads: When the number of operating threads is greater than the configured number, limit the flow!
  2. QPS: When the number of concurrent requests per second exceeds the configured value, limit traffic!

2. Process mode

  1. Direct: Direct current limiting, as shown in the example above.
  2. Association: The number of associated resources reaches the threshold. As a result, the current resources are restricted. (as follows: when B exceeds QPS of 1, A limits the current:)

  1. Link: The upstream of the link reaches the threshold, and the current resource traffic is limited. For example, the upstream of the interface is sentinel_spring_web_context. If the sentinel_spring_web_context exceeds the threshold, the demo stream limits!

3. Flow control effect

  1. Direct failure: Throws an exception directly, as in the previous example.
  2. Warm up: When the system is at a low water level for a long time, when the flow increases suddenly, pulling the system to a high water level may overwhelm the system instantly. Through the “cold start”, the flow slowly increases to the upper limit of the threshold in a certain period of time, giving the cold system a time to warm up, preventing the cold system from being overwhelmed. Warm up cold startup is mainly used in scenarios that require extra startup costs, such as establishing database connections and killing seconds, to prevent the service from crashing instantly. In plain English, it takes some time to reach the preset QPS based on the cold loading factor, which defaults to 3. The following figure means that the initial threshold is 10/3 = 3, and the QPS reaches 10 in 5 seconds.

  1. Queuing: When the threshold is reached and requests are queued for more than 1s, an exception is thrown.

2. The drop

1. Slow call ratio

Fuses are triggered when two conditions are met:

  1. The number of requests exceeds the minimum number of requests. And then we have five per second.
  2. Slow requests reach the set ratio. (Number of times the request time is greater than the maximum RT * proportional threshold)

2. Abnormal ratio

You need two things.

  1. More than the minimum number of requests per second, which is five.
  2. The abnormal ratio exceeds 50% triggers a fuse break.

3. The number of abnormal

You need two things.

  1. More than the minimum number of requests per second, which is five.
  2. The number of exceptions is greater than 5.

3. Hotspot rules

The hotspot rule is to limit traffic based on parameter values. If the monitoring/Demo interface has the first parameter, the QPS per second is 1. If the first parameter is “A”, the QPS is 20.

1. System rules

System protection rules control the incoming flow at the application level, and monitor application indicators from several dimensions, such as load of a single machine, CPU usage, average RT, incoming QPS and number of concurrent threads, so that the system can run as fast as possible in the maximum throughput and ensure the overall stability of the system.

  1. Load adaptive (only for Linux/ UNIX-like machines) : Load1 of the system is used as an inspiration indicator to implement adaptive system protection. System protection (BBR phase) is triggered when system load1 exceeds the set heuristics value and the current number of concurrent threads in the system exceeds the estimated system capacity. System capacity is determined by the systemmaxQps * minRtEstimated. The setting reference value is generallyCPU cores * 2.5.
  2. CPU Usage (version 1.5.0+) : When the CPU usage exceeds the threshold, system protection is triggered (value range: 0.0 to 1.0).
  3. Average RT: System protection is triggered when the average RT of all inlet traffic on a single machine reaches a threshold, in milliseconds.
  4. Number of concurrent threads: System protection is triggered when the number of concurrent threads for all incoming traffic on a single machine reaches a threshold.
  5. Inlet QPS: System protection is triggered when the QPS of all inlet flows on a single machine reaches the threshold.

It can be understood that system rules are global traffic limiting configurations. Traffic limiting can be implemented based on global QPS of services and CPU of machines.

Problem 4.

Fault 1: An error is reported by Sentinel. View the log.The fastJSON version is incorrect. Then go to the sentinel of the current object and check the jar package version.