<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[Heck's  Blog]]></title> 
<link>https://www.heckjj.com/index.php</link> 
<description><![CDATA[一瞬间的决定，往往可以改变很多，事实上，让自己成功的往往不是知识，是精神！ 如果你总是为自己找借口，那只好让成功推迟。执行力，今天！]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[Heck's  Blog]]></copyright>
<item>
<link>https://www.heckjj.com/post//</link>
<title><![CDATA[Tomcat经常假死的原因及解决方案]]></title> 
<author>Heck &lt;@hecks.tk&gt;</author>
<category><![CDATA[运维管理]]></category>
<pubDate>Thu, 13 Oct 2022 00:52:36 +0000</pubDate> 
<guid>https://www.heckjj.com/post//</guid> 
<description>
<![CDATA[ 
	我的服务器配置:linux+tomcat<br/><br/>出现现象：Linux服务器没有崩，有浏览器中访问页面，出现无法访问的情况,没有报4xx或5xx错误(假死),并且重启tomcat后，恢复正常。<br/><br/>原因:tomcat默认最大连接数(线程数)200个,默认每一个连接的生命周期2小时(7200秒),tomcat使用http 1.1协议，而http1.1默认是长连接。tomcat接受处理完请求后，socket没有主动关闭，因此如果在2小时内，请求数超过200个，服务器就会出现上述假死现象。<br/><br/>解决方案1：及时断开socket<br/>protocol=&quot;org.apache.coyote.http11.Http11NioProtocol&quot;<br/><br/><br/>解决方案2：修改tomcat配置文件，修改最大连接数(增大)<br/><br/><br/>修改server.xml配置文件，Connector节点中增加acceptCount和maxThreads这两个属性的值，并且使acceptCount大于等于maxThreads：<br/><br/>&lt;Connector port=&quot;8080&quot; protocol=&quot;HTTP/1.1&quot;<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;connectionTimeout=&quot;20000&quot;&nbsp;&nbsp;<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; redirectPort=&quot;8443&quot; acceptCount=&quot;500&quot; maxThreads=&quot;400&quot; /&gt;<br/><br/>解决方案3：修改linux的TCP超时时间(socket生命周期)限制<br/><br/>vi /etc/sysctl.conf<br/># Decrease the time default value for tcp_fin_timeout connection<br/>net.ipv4.tcp_fin_timeout = 30<br/># Decrease the time default value for tcp_keepalive_time connection<br/>net.ipv4.tcp_keepalive_time = 1800<br/># 探测次数<br/>net.ipv4.tcp_keepalive_probes=2<br/># 探测间隔秒数<br/>net.ipv4.tcp_keepalive_intvl=2<br/> <br/>编辑完 /etc/sysctl.conf,要重启network 才会生效<br/>[root@temp /]# /etc/rc.d/init.d/network restart
]]>
</description>
</item><item>
<link>https://www.heckjj.com/post//#blogcomment</link>
<title><![CDATA[[评论] Tomcat经常假死的原因及解决方案]]></title> 
<author> &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 01 Jan 1970 00:00:00 +0000</pubDate> 
<guid>https://www.heckjj.com/post//#blogcomment</guid> 
<description>
<![CDATA[ 
	
]]>
</description>
</item>
</channel>
</rss>