Project startup settings: java -Xmx4g -Xms4g -jar *.jar
when testing
Execute: ./wrk -t 5 -c100 -d 6 --latency -T 40 http://192.168.1.206:8004/qixiangControler/queryData?currentPage=1
Use 5 threads for each case, and 100, 200, 500, 1000 for concurrency testing
The stress test wrk tool uses:
Source address: https://github.com/wg/wrk
Install:
git clone https://github.com/wg/wrk.git cd wrk make
After the installation is complete, perform a stress test:
./wrk -t 5 -c19 -d 6 --latency -T 40 http://192.168.1.206:8004/qixiangControler/queryData?currentPage=1
Parameter Description:
-c, --connections <N> Connections to keep open number of connections, concurrent -d, --duration <T> Duration of test stress test duration, that is, in how many seconds the stress test will be performed, and it will end automatically after the time expires -t, --threads <N> Number of threads to use Number of threads to use, set to 2-3 times the combined number of cpu -s, --script <S> Load Lua script file -H, --header <H> Add header to request --latency Print latency statistics Print latency distribution, that is, the corresponding time distribution --timeout <T> Socket/request timeout The default timeout for each thread is 1 second -v, --version Print version details
Practical example: The following is a stress test of an interface with 5 threads and 19 concurrent
./wrk -t 5 -c19 -d 6 --latency -T 40 http://192.168.1.206:8004/qixiangControler/queryData?currentPage=1
Running 6s test @ http://192.168.1.206:8004/qixiangControler/queryData?currentPage=1 5 threads and 19 connections Thread StatsAvg Stdev Max +/- Stdev Latency response time 5.33s Average response time 343.23ms 5.75s Maximum response time 60.00% Req/Sec Throughput 2.20 Average Throughput 3.43 10.00 Maximum Throughput 90.00% Latency Distribution 50% 5.34s 75% 5.73s 90% 5.75s 99% 5.75s
15 requests in 6.01s, 21.53MB read, (processing 15 requests in 6 seconds, and processing 2.5 requests per second, the total throughput is 2.5)
Requests/sec: 2.50 total throughput
Transfer/sec: 3.58MB
Increasing the -c parameter is the number of concurrency, and the throughput is reduced, so the maximum concurrency is 19
2. Apache Jmeter graphical stress testing tool