Automatically Calculate Parameter Signature for Interface Requests
Usage Scenarios
Performance testing for specified interfaces.
Implementation Method
To achieve high-performance concurrency requirements, a self-developed stress testing engine is used, capable of achieving over ten thousand concurrent requests.
The project is open-source, GitHub address: https://github.com/EchoAPI-Team/runnerGo
Stress Test Result Calculation Method
Stress Test Value | Meaning | Calculation Method |
---|---|---|
Total Requests | Total number of requests sent | Concurrency * Rounds |
Execution Time | Execution time of the stress test task | End time of the task - Start time of the task |
Successful Requests | Number of requests with HTTP status code 200 | N/A |
Failed Requests | Number of requests with HTTP status code other than 200 or connection exceptions | N/A |
Error Rate | Error rate of the stress test | (Number of failures / Total requests) * 1000 |
Total Received Data | Total bytes of data received | Sum of the bytes of each response |
Requests Per Second | Average number of requests per second | Total requests / Total time |
Successful Requests Per Second | Average number of successful requests per second | Total successful requests / Total time of successful requests |
Bytes Received Per Second | Average bytes received per second | Total received bytes / Total time |
Maximum Response Time | Maximum execution time of a request | Longest execution time among all requests |
Minimum Response Time | Minimum execution time of a request | Shortest execution time among all requests |
Average Response Time | Average response time | Total time / Total requests |
10% | Time to complete the first 10% of requests | Sort all request times in ascending order, take the 10% position |
25% | Time to complete the first 25% of requests | Sort all request times in ascending order, take the 25% position |
50% | Time to complete the first 50% of requests | Sort all request times in ascending order, take the 50% position |
75% | Time to complete the first 75% of requests | Sort all request times in ascending order, take the 75% position |
90% | Time to complete the first 90% of requests | Sort all request times in ascending order, take the 90% position |
95% | Time to complete the first 95% of requests | Sort all request times in ascending order, take the 95% position |
Practice
The results of concurrent tests are easily influenced by external factors, so it is necessary to minimize external influences during stress testing.
External factors that affect stress test results include local handle number limits, DNS resolution speed, network quality, server connection limits, etc.
For example, using 10,000 concurrent requests can easily exceed the local maximum handle number limit (usually 1024), causing requests that exceed the handle limit to fail due to handle constraints.
Therefore, choosing an appropriate number of concurrent requests is very important for testing interface performance. More concurrency is not always better.
It is recommended to test with 10, 100, 500, and 1000 concurrent requests first. If the failure rate is less than 1%, then consider gradually increasing the concurrency. Only increasing the number of requests per second in a sustainable manner is a healthy usage method.