我正在使用 embed jetty/tomcat 对 Spring Boot 应用程序进行负载测试,但出现了奇怪的行为。我使用 apache ab 进行测试
ab -n 100000 -c 1000 http://127.0.0.1:8080/ping
Server Software:
Server Hostname: 127.0.0.1
Server Port: 8080
Document Path: /ping
Document Length: 2 bytes
Concurrency Level: 1000
Time taken for tests: 5.253 seconds
Complete requests: 100000
Failed requests: 0
Total transferred: 17000000 bytes
HTML transferred: 200000 bytes
Requests per second: 19038.05 [#/sec] (mean)
Time per request: 52.526 [ms] (mean)
Time per request: 0.053 [ms] (mean, across all concurrent requests)
Transfer rate: 3160.61 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 37 222.1 0 3006
Processing: 0 7 21.9 3 855
Waiting: 0 7 21.7 3 853
Total: 0 44 228.0 4 3052
Percentage of the requests served within a certain time (ms)
50% 4
66% 7
75% 9
80% 11
90% 22
95% 39
98% 1004
99% 1017
100% 3052 (longest request)
所以一些请求被卡在某个地方。
使用码头,我尝试了不同的值:
_maxThreads, _minThread
与tomcat:
max-connections, max-threads, min-spare-threads
在探查器中,我发现了下一个:
org.eclipse.jetty.util.thread.QueuedThreadPool$2.run() 16,215ms
org.eclipse.jetty.util.thread.QueuedThreadPool.access$800
org.eclipse.jetty.util.thread.QueuedThreadPool.iddleJobPoll
org.eclipse.jetty.util.BlockingArrayQueue.poll 13,915ms
谢谢!