<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>LinuxByte &#187; max_filedesc</title>
	<atom:link href="http://www.linuxbyte.org/tag/max_filedesc/feed" rel="self" type="application/rss+xml" />
	<link>http://www.linuxbyte.org</link>
	<description>一个Linux Blog</description>
	<lastBuildDate>Tue, 22 Jun 2010 15:10:55 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>高负载情况下的squid 最大可打开文件数</title>
		<link>http://www.linuxbyte.org/squid-max_filedesc.html</link>
		<comments>http://www.linuxbyte.org/squid-max_filedesc.html#comments</comments>
		<pubDate>Fri, 14 Mar 2008 09:52:44 +0000</pubDate>
		<dc:creator>xiao H</dc:creator>
				<category><![CDATA[服务器应用]]></category>
		<category><![CDATA[max_filedesc]]></category>
		<category><![CDATA[squid]]></category>
		<category><![CDATA[ulimit]]></category>

		<guid isPermaLink="false">http://www.linuxbyte.org/squid-max_filedesc</guid>
		<description><![CDATA[这个问题只有在squid压力大时才会出现，linux默认的用户最大可开启文件数为1024，而编squid 2.6的版本的话编译时默认参数为max_filedesc 16384，这样在高负债下squid 的性能就会很受影响。所以我们可... ]]></description>
			<content:encoded><![CDATA[<p>这个问题只有在squid压力大时才会出现，linux默认的用户最大可开启文件数为1024，而编squid 2.6的版本的话编译时默认参数为max_filedesc 16384，这样在高负债下squid 的性能就会很受影响。所以我们可以用ulimit 命令改一下啊，增大这个数值。  <span id="more-77"></span></p>
<p>#ulimit -Hn 20480</p>
<p>查看squid具体用了多少文件描述符的方法<br />
#squidclient -p 80 -U manager -W squidstats mgr:info</p>
<p>输出结果中:</p>
<p>File descriptor usage for squid:<br />
        Maximum number of file descriptors:   16384<br />
        Largest file desc currently in use:    169<br />
        Number of file desc currently in use:  132<br />
        Files queued for open:                   0<br />
        Available number of file descriptors: 16252<br />
        Reserved number of file descriptors:   100<br />
        Store Disk files open:                  39<br />
        IO loop method:                     epoll</p>
<p>表示最大的文件描述符为16384，当前使用的最大的文件描述符是169，总共在使用的有132个。</p>
<p>附：</p>
<p>ulimit命令的详细介绍</p>
<p><strong>语　　法：</strong>ulimit [-aHS][-c &lt;core文件上限&gt;][-d &lt;数据节区大小&gt;][-f &lt;文件大小&gt;][-m &lt;内存大小&gt;][-n &lt;文件数目&gt;][-p &lt;缓冲区大小&gt;][-s &lt;堆叠大小&gt;][-t &lt;CPU时间&gt;][-u &lt;程序数目&gt;][-v &lt;虚拟内存大小&gt;]</p>
<p><strong>补充说明：</strong>ulimit为shell内建指令，可用来控制shell执行程序的资源。</p>
<p><strong>参　　数：</strong><br />
  -a 　显示目前资源限制的设定。 <br />
  -c &lt;core文件上限&gt; 　设定core文件的最大值，单位为区块。 <br />
  -d &lt;数据节区大小&gt; 　程序数据节区的最大值，单位为KB。 <br />
  -f &lt;文件大小&gt; 　shell所能建立的最大文件，单位为区块。 <br />
  -H 　设定资源的硬性限制，也就是管理员所设下的限制。 <br />
  -m &lt;内存大小&gt; 　指定可使用内存的上限，单位为KB。 <br />
  -n &lt;文件数目&gt; 　指定同一时间最多可开启的文件数。 <br />
  -p &lt;缓冲区大小&gt; 　指定管道缓冲区的大小，单位512字节。 <br />
  -s &lt;堆叠大小&gt; 　指定堆叠的上限，单位为KB。 <br />
  -S 　设定资源的弹性限制。 <br />
  -t &lt;CPU时间&gt; 　指定CPU使用时间的上限，单位为秒。 <br />
  -u &lt;程序数目&gt; 　用户最多可开启的程序数目。 <br />
  -v &lt;虚拟内存大小&gt; 　指定可使用的虚拟内存上限，单位为KB。</p>
<h3  class="related_post_title">与本文关系暧昧的文字</h3><ul class="related_post"><li><a href="http://www.linuxbyte.org/squid-xian-zhi-yong-hu-bing-fa-lian-jie-shu-2.html" title="Squid 限制用户并发连接数">Squid 限制用户并发连接数</a></li><li><a href="http://www.linuxbyte.org/%e5%8d%87%e7%ba%a7squid-26-%e5%88%b027-%e7%9a%84%e5%86%a4%e6%9e%89%e8%b7%af.html" title="升级squid 2.6 到2.7 的冤枉路">升级squid 2.6 到2.7 的冤枉路</a></li><li><a href="http://www.linuxbyte.org/squid-unofficial-support-for-rhelcentos.html" title="Squid unofficial support for RHEL/CentOS">Squid unofficial support for RHEL/CentOS</a></li><li><a href="http://www.linuxbyte.org/wang-ba-mei-ip-xian-su-bu-chong-squid-xian-su.html" title="网吧每IP 限速补充（squid 限速）">网吧每IP 限速补充（squid 限速）</a></li><li><a href="http://www.linuxbyte.org/qzone-squid-iptables.html" title="新版qzone 无法被squid 缓存">新版qzone 无法被squid 缓存</a></li><li><a href="http://www.linuxbyte.org/squid-havp-clamav.html" title="squid+havp+clamav搭建防毒代理">squid+havp+clamav搭建防毒代理</a></li><li><a href="http://www.linuxbyte.org/linux-iptables-nat-squid-pdnsd.html" title="网吧Linux 网关设置记录">网吧Linux 网关设置记录</a></li><li><a href="http://www.linuxbyte.org/squid-command-squidclient-purge.html" title="使用squid命令查看squid运行状态和清除cache ">使用squid命令查看squid运行状态和清除cache </a></li></ul><hr />
<p><small>© xiao H for <a href="http://www.linuxbyte.org">LinuxByte</a>, 2008<br />
Source: <a href="http://www.linuxbyte.org/squid-max_filedesc.html">高负载情况下的squid 最大可打开文件数</a><br />
<a href="http://www.linuxbyte.org/squid-max_filedesc.html#comments">No comment</a><br />
Post tags: <a href="http://www.linuxbyte.org/tag/max_filedesc" rel="tag">max_filedesc</a>, <a href="http://www.linuxbyte.org/tag/squid" rel="tag">squid</a>, <a href="http://www.linuxbyte.org/tag/ulimit" rel="tag">ulimit</a><br/>
</small></p>
	标签：<a href="http://www.linuxbyte.org/tag/max_filedesc" title="max_filedesc" rel="tag">max_filedesc</a>, <a href="http://www.linuxbyte.org/tag/squid" title="squid" rel="tag">squid</a>, <a href="http://www.linuxbyte.org/tag/ulimit" title="ulimit" rel="tag">ulimit</a><br />

	<h4>相关日志</h4>
	<ul class="st-related-posts">
	<li><a href="http://www.linuxbyte.org/wang-ba-mei-ip-xian-su-bu-chong-squid-xian-su.html" title="网吧每IP 限速补充（squid 限速） (2010-01-31)">网吧每IP 限速补充（squid 限速）</a> (2)</li>
	<li><a href="http://www.linuxbyte.org/linux-iptables-nat-squid-pdnsd.html" title="网吧Linux 网关设置记录 (2008-05-27)">网吧Linux 网关设置记录</a> (0)</li>
	<li><a href="http://www.linuxbyte.org/qzone-squid-iptables.html" title="新版qzone 无法被squid 缓存 (2008-10-08)">新版qzone 无法被squid 缓存</a> (3)</li>
	<li><a href="http://www.linuxbyte.org/%e5%8d%87%e7%ba%a7squid-26-%e5%88%b027-%e7%9a%84%e5%86%a4%e6%9e%89%e8%b7%af.html" title="升级squid 2.6 到2.7 的冤枉路 (2010-03-02)">升级squid 2.6 到2.7 的冤枉路</a> (0)</li>
	<li><a href="http://www.linuxbyte.org/squid-command-squidclient-purge.html" title="使用squid命令查看squid运行状态和清除cache (2008-03-03)">使用squid命令查看squid运行状态和清除cache</a> (0)</li>
</ul>


<p><small>Feed enhanced by <a href='http://planetozh.com/blog/my-projects/wordpress-plugin-better-feed-rss/'>Better Feed</a> from  <a href='http://planetozh.com/blog/'>Ozh</a></small></p>
]]></content:encoded>
			<wfw:commentRss>http://www.linuxbyte.org/squid-max_filedesc.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
