tomcat性能优化记录

最基础的使用:
jmeter500个线程
服务端的连接情况:

zefenglin@192 bin % netstat  |grep 38080|grep '^tcp' |awk '{print $6}'  |sort |uniq -c 
9708 CLOSE_WAIT
 292 ESTABLISHED

tomcat设置最大连接数为10000,性能明显有提升,基本稳定,很少报错服务端连接数为500,大量的time_wait,原因未明?

zefenglin@192 bin % netstat  |grep 38080|grep '^tcp' |awk '{print $6}'  |sort |uniq -c 
 488 ESTABLISHED
  12 SYN_RCVD
6860 TIME_WAIT
zefenglin@192 bin % netstat  |grep 38080|grep '^tcp' |awk '{print $6}'  |sort |uniq -c 
 458 ESTABLISHED
  42 FIN_WAIT_1
7663 TIME_WAIT
<Connector port="38080" protocol="HTTP/1.1"
               connectionTimeout="20000" maxThreads="10000"
               redirectPort="8443" />

jmeter,1000线程;报错明显增加:
大量的connetction reset,connection timeout

zefenglin@192 bin % netstat  |grep 38080|grep '^tcp' |awk '{print $6}'  |sort |uniq -c 
 747 ESTABLISHED
  17 FIN_WAIT_1
  25 SYN_RCVD
12746 TIME_WAIT
zefenglin@192 bin % netstat  |grep 38080|grep '^tcp' |awk '{print $6}'  |sort |uniq -c 
 366 ESTABLISHED
  59 FIN_WAIT_1
7129 TIME_WAIT

查看端口所占用的进程号
lsof -i:38080

#查看端口所占用的进程号
zefenglin@192 ~ % lsof -i:38080
COMMAND PID      USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
java    682 zefenglin   54u  IPv6 0x6ff4ecc6dcf5bb1b      0t0  TCP *:38080 (LISTEN)

在这里插入图片描述
在这里插入图片描述在这里插入图片描述
阻塞总数
Blocked count is the total number of times that the thread blocked to enter or reenter a monitor. I.e. the number of times a thread has been in the java.lang.Thread.State.BLOCKED state.

等待总数
Waited count is the total number of times that the thread waited for notification. i.e. the number of times that a thread has been in the ava.lang.Thread.State.WAITING or java.lang.Thread.State.TIMED_WAITING state.

<Executor name="tomcatThreadPool" namePrefix ="lzf-exec-" maxThreads="2000" minSpareThreads="2000" />
<Connector port="38080" protocol="HTTP/1.1" acceptCount="1000" maxConnections="15000"
 connectionTimeout="20000" executor="tomcatThreadPool"
 maxKeepAliveRequests="2"
 redirectPort="8443" />
 
<Context path="" docBase="/Users/zefenglin/opensource/apache-tomcat-8.5.70/webapps/high-concurrent"/>       
 JSSE_OPTS="-Djdk.tls.ephemeralDHKeySize=2048 -DlogPath=/Users/zefenglin/workspace/gitee2/highconcurrent/logs"

TCP协议端口状态说明

详解tomcat的连接数与线程池

Connection reset原因分析和解决方案

tomcat长连接、短连接配置及用途

jconsole线程面板中的阻塞总数和等待总数

不可不知的socket和TCP连接过程

张大胖的socket

Tomcat connector属性配置官方文档

Tomcat中Max-thread配置项对TPS的影响

connetction reset
read timeout
connection time out

疑问:
wait和sleep的区别:
线程状态:wait和blocked的区别
connetction reset
read timeout
connection time out
socket ,TCP连接, 和http请求,线程之间的关系是怎样的?

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值