压测完nginx 突然想搞一下springboot内嵌的tomcat的 threads的参数
一不做二不休, 直接就着脚本进行学习和验证
产品里面默认参数值是 500 我这边改大一下
tomcat
threads:
max: 2000
accept-count: 10000
max-connections: 200000
connection-timeout: 600000
ab -c 5000 -n 50000 -k https://127.0.0.1:5401/index.html
ab -c 1000 -n 50000 -k https://127.0.0.1:5401/index.html
##注意不同测试测试, 结果不尽相同, 主要是看趋势##
##本次测试取第二次预热之后的##
threads 为 500 时 1000并发
https 的吞吐量TPS为:10260
第一次:4418.62
第二次:10260.98
threads 为 500 时 5000并发
https 的吞吐量TPS为:8701
第一次:3779.16
第二次:8701.95
threads 为 2000 时 1000并发
https 的吞吐量TPS为:11534
第一次:4982.65
第二次:11534.35
threads 为 2000 时 5000并发
https 的吞吐量TPS为:8267
第一次:3573.94
第二次:8267.08
threads为500时 1000并发比5000并发性能要好.
threads为2000时 1000并发比5000并发性能要好
1000并发时: threads2000比threads500性能要好.
5000并发时: threads500比threads2000性能要好.
感觉高并发下面. 500和2000的差异性不是很大,不会超过10%.
但是需要说明一下. threads2000时 会多占用2G的内存. 用来存放堆栈信息
对机器的压力会比较大一些. 进行容器或者是其他处理时需要关注一下这一块的内存设置.
经过预热和为经过预热性能差距是一倍多. 建议现场有机会还是需要预热在上线.
或者是先小流量引入,再大流量进行使用. 保证TPS稳定.
- Java Heap (reserved=24014MB, committed=5034MB)
(mmap: reserved=24014MB, committed=5034MB)
- Class (reserved=1151MB, committed=142MB)
(classes #23154)
(malloc=17MB #35188)
(mmap: reserved=1134MB, committed=125MB)
- Thread (reserved=137MB, committed=137MB)
(thread #137)
(stack: reserved=136MB, committed=136MB)
- Code (reserved=253MB, committed=55MB)
(malloc=9MB #11867)
(mmap: reserved=244MB, committed=46MB)
- GC (reserved=893MB, committed=829MB)
(malloc=16MB #477)
(mmap: reserved=877MB, committed=813MB)
- Java Heap (reserved=24014MB, committed=11150MB)
(mmap: reserved=24014MB, committed=11150MB)
- Class (reserved=1355MB, committed=374MB)
(classes #60146)
(malloc=23MB #110948)
(mmap: reserved=1332MB, committed=351MB)
- Thread (reserved=389MB, committed=389MB)
(thread #388)
(stack: reserved=387MB, committed=387MB)
(malloc=1MB #1950)
(arena=1MB #762)
- Code (reserved=266MB, committed=130MB)
(malloc=22MB #30252)
(mmap: reserved=244MB, committed=108MB)
- GC (reserved=893MB, committed=843MB)
(malloc=16MB #1898)
(mmap: reserved=877MB, committed=827MB)
- Java Heap (reserved=24014MB, committed=11150MB)
(mmap: reserved=24014MB, committed=11150MB)
- Class (reserved=1359MB, committed=378MB)
(classes #60595)
(malloc=23MB #115122)
(mmap: reserved=1336MB, committed=355MB)
- Thread (reserved=2387MB, committed=2387MB)
(thread #2377)
(stack: reserved=2376MB, committed=2376MB)
(malloc=8MB #11895)
(arena=3MB #4740)
- Code (reserved=267MB, committed=139MB)
(malloc=24MB #32028)
(mmap: reserved=244MB, committed=115MB)
- GC (reserved=893MB, committed=843MB)
(malloc=16MB #2029)
(mmap: reserved=877MB, committed=827MB)
- Java Heap (reserved=24014MB, committed=5481MB)
(mmap: reserved=24014MB, committed=5481MB)
- Class (reserved=1167MB, committed=160MB)
(classes #25730)
(malloc=17MB #40906)
(mmap: reserved=1150MB, committed=143MB)
- Thread (reserved=156MB, committed=156MB)
(thread #156)
(stack: reserved=155MB, committed=155MB)
- Code (reserved=254MB, committed=63MB)
(malloc=11MB #13516)
(mmap: reserved=244MB, committed=53MB)
- GC (reserved=893MB, committed=830MB)
(malloc=16MB #572)
(mmap: reserved=877MB, committed=814MB)
- Java Heap (reserved=24014MB, committed=9355MB)
(mmap: reserved=24014MB, committed=9355MB)
- Class (reserved=1290MB, committed=299MB)
(classes #44502)
(malloc=20MB #82414)
(mmap: reserved=1270MB, committed=279MB)
- Thread (reserved=273MB, committed=273MB)
(thread #273)
(stack: reserved=272MB, committed=272MB)
(malloc=1MB #1375)
- Code (reserved=259MB, committed=93MB)
(malloc=16MB #21262)
(mmap: reserved=244MB, committed=77MB)
- GC (reserved=893MB, committed=839MB)
(malloc=16MB #1265)
(mmap: reserved=877MB, committed=824MB)
- Java Heap (reserved=24014MB, committed=11122MB)
(mmap: reserved=24014MB, committed=11122MB)
- Class (reserved=1353MB, committed=370MB)
(classes #58279)
(malloc=23MB #112171)
(mmap: reserved=1330MB, committed=347MB)
- Thread (reserved=846MB, committed=846MB)
(thread #843)
(stack: reserved=842MB, committed=842MB)
(malloc=3MB #4225)
(arena=2MB #1672)
- Code (reserved=267MB, committed=137MB)
(malloc=23MB #31921)
(mmap: reserved=244MB, committed=113MB)
Maven实例:pom.xml文件中添加更换依赖 org.springframework.boot spring-boot-starter