Test Environment Information
Server Configuration
The test environment | CPU | memory |
---|---|---|
Deployed in Kubesphere | 2 | 4G |
Testing tools
The serial number | Test tool name | Environmental preparation and requirements | |
---|---|---|---|
1 | Jmeter | Run locally |
The test case
CASE 1 Basic usage of Sentinel DashBoard
-
Real-time monitoring
Monitors the real-time status of requests. If there are no incoming requests, dashboard is blank.
-
Request link
Real-time link request rule monitoring.
-
API management
Gateway service user-defined API management rules
-
Flow control rules
- QPS
- The number of threads
-
Drop rules
-
Rules of the system
-
Machine list
CASE 2 Flow control threshold type QPS/ Fast Failure
-
QPS value 20 The flow control policy is 1s
-
Request the address
POST /property/find/page/list
Parameters: {” currPageNo “:” 1 “, “currPageSize” : “10”}
-
Jmeter parameter Settings
The number of threads is 40, and ram-up is 1s, that is, 40 requests are initiated within 1s
-
The test results
Jmeter result returned
50% of requests returned 429 Blocked By Sentinel
- DashBoard monitoring diagram
CASE 3 Flow control threshold type QPS/ Uniform queuing
-
QPS value 20 the flow control policy is uniform queuing interval 1s queuing timeout time 500ms
-
Request the address
POST /property/find/page/list
Parameters: {” currPageNo “:” 1 “, “currPageSize” : “10”}
-
Jmeter parameter Settings
The number of threads is 40, and ram-up is 1s, that is, 40 requests are initiated within 1s
-
The test results
Jmeter result returned
Results are normal and the response time is stretched
-
DashBorad monitoring diagram
CASE 4 Flow control Threshold Type Number of threads 20 Number of concurrent applications 40
-
Set the number of rule threads to 20
-
The Number of Jmeter threads is 40, ram-up 1s, that is, 40 requests are initiated within 1s
-
Request address permission center test environment
-
API 1 POST/property/find/page/list
-
Parameter {” currPageNo “:” 1 “, “currPageSize” : “10”}
-
Jmeter requests the results
- The DashBoard response
-
-
API 2 GET /check/select/query? userName=xxxxx
-
Parameter requestParam userName
-
Jmeter requests the results
-
The DashBoard response
-
-
-
conclusion
-
Note that the number of threads specified for gateway flow control is significantly related to the actual flow control API response time.
-
Use API for flow control
CASE 5 Flow control Threshold Type Number of threads 10 Number of concurrent applications 200
** The number of regular threads is set to 10 **
-
Jmeter parameter Settings
The number of threads is 200, ram-up 1s, that is, 200 requests are initiated within 1s
-
Request the address
GET /check/select/query? userName=xxxxx
-
The test results
-
DashBoard monitoring
Set the number of rule threads to 14
-
Jmeter parameter Settings
The number of threads is 200, ram-up 1s, that is, 200 requests are initiated within 1s
-
Request address permission center test environment
GET /check/select/query? userName=xxxxx
-
The test results
-
DashBoard monitoring
The test results
Summary of test results
Current limiting rules | API interface | In the Jmeter requests | Sentine threshold | The response time | Pass rate |
---|---|---|---|---|---|
QPS/ Quick failure | /property/find/page/list | 20QPS | 20 QPS | 0.5 1 s | 100% |
QPS/ Quick failure | /property/find/page/list | 40QPS | 20 QPS | 0.5 1 s | 50% |
QPS/ uniform queuing | /property/find/page/list | 40QPS | 20 qp/timeout 500 ms | 1-3s | 100% |
API threads | /check/select/query | 200 concurrency | Thread 10 | 30-100ms | 91.5% |
API threads | /check/select/query | 200 concurrency | Thread 14 | 30-100ms | 100% |
API threads | /property/find/page/list | 40 concurrency | Thread 20 | 1-2s | 50% |
API threads | /property/find/page/list | 40 concurrency | Thread 40 | 1-3s | 100% |
conclusion
- Qps-based threshold types (fast failure and uniform queuing) Based on the QPS configuration, traffic limiting rules are accurate and effective.
- Based on the threshold type of the thread, there is a correlation between the thread setting and the interface response time and the number of concurrent requests based on the test results. Based on the different APIS tested,
- Using Sentinel flow rules, the function is complete and valid.