<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[向东博客 专注WEB应用 构架之美 --- 构架之美，在于尽态极妍 | 应用之美，在于药到病除]]></title> 
<link>http://jackxiang.com/index.php</link> 
<description><![CDATA[赢在IT，Playin' with IT,Focus on Killer Application,Marketing Meets Technology.]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[向东博客 专注WEB应用 构架之美 --- 构架之美，在于尽态极妍 | 应用之美，在于药到病除]]></copyright>
<item>
<link>http://jackxiang.com/post//</link>
<title><![CDATA[nginx 查看 并发连接数]]></title> 
<author>jack &lt;xdy108@126.com&gt;</author>
<category><![CDATA[Web服务器]]></category>
<pubDate>Sat, 14 Dec 2013 03:13:13 +0000</pubDate> 
<guid>http://jackxiang.com/post//</guid> 
<description>
<![CDATA[ 
	通过查看Nginx的并发连接，我们可以更清除的知道网站的负载情况。Nginx并发查看有两种方法（之所以这么说，是因为笔者只知道两种），一种是通过 web界面，一种是通过命令，web查看要比命令查看显示的结果精确一些。下面介绍这两种查看方法<br/><br/>No1、通过浏览器查看 <br/>&nbsp;&nbsp;&nbsp;&nbsp;通过web界面查看时Nginx需要开启status模块，也就是安装Nginx时加上&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--with-http_stub_status_module&nbsp;&nbsp; 然后配置Nginx.conf，在server点里面加入如下内容<br/><textarea name="code" class="php" rows="15" cols="100">
location /status &#123;
stub_status on;
access_log /usr/local/nginx/logs/status.log;
auth_basic &quot;NginxStatus&quot;; &#125;
</textarea><br/><br/>&nbsp;&nbsp;配置完后重新启动Nginx后我们可以通过浏览器访问http://localhost/status 查看。<br/><a href="http://luwenju.blog.51cto.com/attachment/201005/201005231274583316394.jpg" target="_blank"><img src="http://luwenju.blog.51cto.com/attachment/201005/201005231274583316394.jpg" class="insertimage" alt="点击在新窗口中浏览此图片" title="点击在新窗口中浏览此图片" border="0"/></a><br/>解析：<br/>Active connections&nbsp;&nbsp;&nbsp;&nbsp;//当前 Nginx 正处理的活动连接数。<br/>server accepts handled requests //总共处理了8 个连接 , 成功创建 8 次握手,总共处理了500个请求。<br/>Reading //nginx 读取到客户端的 Header 信息数。<br/>Writing //nginx 返回给客户端的 Header 信息数。<br/>Waiting //开启 keep-alive 的情况下，这个值等于 active - (reading + writing)，意思就是 Nginx 已经处理完正在等候下一次请求指令的驻留连接<br/>No2、通过命令查看 <br/>#netstat -n &#124; awk &#039;/^tcp/ &#123;++S[$NF]&#125; END &#123;for(a in S) print a, S[a]&#125;&#039;<br/>TIME_WAIT 17<br/>ESTABLISHED 3254<br/>LAST_ACK 236<br/>FIN_WAIT_1 648<br/>FIN_WAIT_2 581<br/>CLOSING 7<br/>CLOSE_WAIT 4916<br/><br/>解析：<br/>CLOSED&nbsp;&nbsp;//无连接是活动的或正在进行<br/>LISTEN&nbsp;&nbsp;//服务器在等待进入呼叫<br/>SYN_RECV&nbsp;&nbsp;//一个连接请求已经到达，等待确认<br/>SYN_SENT&nbsp;&nbsp;//应用已经开始，打开一个连接<br/>ESTABLISHED&nbsp;&nbsp;//正常数据传输状态/当前并发连接数<br/>FIN_WAIT1&nbsp;&nbsp;//应用说它已经完成<br/>FIN_WAIT2&nbsp;&nbsp;//另一边已同意释放<br/>ITMED_WAIT&nbsp;&nbsp;//等待所有分组死掉<br/>CLOSING&nbsp;&nbsp;//两边同时尝试关闭<br/>TIME_WAIT&nbsp;&nbsp;//另一边已初始化一个释放<br/>LAST_ACK&nbsp;&nbsp;//等待所有分组死掉<br/> <br/> <br/>============================================================<br/>来自：http://blog.s135.com/nginx_php_v5/<br/><br/>实践：<br/>[root@localhost 20131212]# netstat -n &#124; awk &#039;/^tcp/ &#123;++S[$NF]&#125; END &#123;for(a in S) print a, S[a]&#125;&#039;<br/>TIME_WAIT 109<br/>ESTABLISHED 63<br/>SYN_RECV 103<br/>LAST_ACK 2
]]>
</description>
</item><item>
<link>http://jackxiang.com/post//#blogcomment</link>
<title><![CDATA[[评论] nginx 查看 并发连接数]]></title> 
<author> &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 01 Jan 1970 00:00:00 +0000</pubDate> 
<guid>http://jackxiang.com/post//#blogcomment</guid> 
<description>
<![CDATA[ 
	
]]>
</description>
</item>
</channel>
</rss>