<?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>五四陈科学院-坚信科学，分享技术 &#187; ab</title>
	<atom:link href="http://www.54chen.com/tag/ab/feed" rel="self" type="application/rss+xml" />
	<link>http://www.54chen.com</link>
	<description>PHP、JAVA、缓存、架构、经验、分享</description>
	<lastBuildDate>Fri, 10 Feb 2012 12:21:03 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Web压力测试工具介绍</title>
		<link>http://www.54chen.com/php-tech/web%e5%8e%8b%e5%8a%9b%e6%b5%8b%e8%af%95%e5%b7%a5%e5%85%b7%e4%bb%8b%e7%bb%8d.html</link>
		<comments>http://www.54chen.com/php-tech/web%e5%8e%8b%e5%8a%9b%e6%b5%8b%e8%af%95%e5%b7%a5%e5%85%b7%e4%bb%8b%e7%bb%8d.html#comments</comments>
		<pubDate>Wed, 26 Nov 2008 09:34:46 +0000</pubDate>
		<dc:creator>cc0cc</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[ab]]></category>
		<category><![CDATA[http_load]]></category>

		<guid isPermaLink="false">http://www.54chen.com/php-tech/web%e5%8e%8b%e5%8a%9b%e6%b5%8b%e8%af%95%e5%b7%a5%e5%85%b7%e4%bb%8b%e7%bb%8d.html</guid>
		<description><![CDATA[<a href="http://www.54chen.com"><img border="0" src="http://www.54chen.com/wp-content/themes/54chen2011/images/54chen-logo.gif"></a><br>以下内容由<a href="http://www.54chen.com">[五四陈科学院]</a>提供<br>1.http_load 下载地址：http://www.acme.com/software/http_load/ 实际运行： bash# http_load -rate 5 -seconds 10 urls -parallel 简写-p ：含义是并发的用户进程数。 -fetches 简写-f ：含义是总计的访问次数 -rate 简写-r ：含义是每秒的访问频率 -seconds简写-s ：含义是总计的访问时间 urls.txt 是一个url 列表，每个url 单独的一行；不可以直接跟一个url，有些博客主说的可以跟一个url是错误的说法。 49 fetches, 2 max parallel, 289880 bytes, in 10.0145 seconds 5916 mean bytes/connection 4.89274 fetches/sec, 28945.1 &#8230;<br><br>想快点找到作者也可以到Twitter上留言: <a href="https://www.twitter.com/54chen" target="_blank">@54chen</a><br>或者你懒得带梯子上墙，请到新浪微博：<a href="http://t.sina.com.cn/54chen" target="_blank">@54chen</a>]]></description>
			<content:encoded><![CDATA[<a href="http://www.54chen.com"><img border="0" src="http://www.54chen.com/wp-content/themes/54chen2011/images/54chen-logo.gif"></a><br>以下内容由<a href="http://www.54chen.com">[五四陈科学院]</a>提供<br><p><strong>1.http_load</strong></p>
<p>下载地址：<a href="http://www.acme.com/software/http_load/" target="_top">http://www.acme.com/software/http_load/</a></p>
<p>实际运行：</p>
<p>bash# http_load -rate 5 -seconds 10 urls</p>
<ul>
<li>-parallel 简写-p ：含义是并发的用户进程数。</li>
<li>-fetches 简写-f ：含义是总计的访问次数</li>
<li>-rate 简写-r ：含义是每秒的访问频率</li>
<li>-seconds简写-s ：含义是总计的访问时间</li>
<li>urls.txt 是一个url 列表，每个url 单独的一行；不可以直接跟一个url，有些博客主说的可以跟一个url是错误的说法。</li>
</ul>
<pre>49 fetches, 2 max parallel, 289880 bytes, in 10.0145 seconds
5916 mean bytes/connection
4.89274 fetches/sec, 28945.1 bytes/sec
msecs/connect: 28.8932 mean, 44.243 max, 24.488 min
msecs/first-response: 63.5362 mean, 81.624 max, 57.803 min
HTTP response codes:
code 200 -- 49</pre>
<pre>解释：</pre>
<pre>
<ul>
<li>49 fetches, 2 max parallel, 289880 bytes, in 10.0145 seconds</li>
<li>说明在上面的测试中运行了49个请求，最大的并发进程数是2，总计传输的数据是289880bytes，运行的时间是10.0145秒</li>
</ul>
<div>
<ul>
<li>5916 mean bytes/connection</li>
<li>说明每一连接平均传输的数据量289880/49=5916</li>
</ul>
<div>
<ul>
<li>4.89274 fetches/sec, 28945.1 bytes/sec</li>
<li>说明每秒的响应请求为4.89274，每秒传递的数据为28945.1 bytes/sec</li>
</ul>
<div>
<ul>
<li>msecs/connect: 28.8932 mean, 44.243 max, 24.488 min</li>
<li>说明每连接的平均响应时间是28.8932 msecs，最大的响应时间44.243 msecs，最小的响应时间24.488 msecs</li>
</ul>
<div></div>
<ul>
<li>msecs/first-response: 63.5362 mean, 81.624 max, 57.803 min</li>
</ul>
<div>
<ul>
<li>HTTP response codes: code 200 — 49</li>
<li>说明打开响应页面的类型，如果403的类型过多，那可能要注意是否系统遇到了瓶颈。</li>
</ul>
<div>
<ul>
<li>一般会关注到的指标是fetches/sec、msecs/connect，它们分别对应的常用性能指标参数QPS-每秒响应用户数和response time，每连接响应用户时间。测试的结果主要也是看这两个值。当然仅有这两个指标并不能完成对性能的分析，我们还需要对服务器的cpu、men进行分析，才能得出结论；</li>
<li>如果要测试HTTPS，需要在编译前指定Makefile中 <strong>SSL_TREE</strong> 的路径：一般为 <em>/usr</em> 或<em>/usr/local</em> 。</li>
</ul>
</div>
</div>
</div>
</div>
</div>
</pre>
<p> </p>
<p><strong>2.ab</strong></p>
<pre>ab -n 1000 -c 50 http://www.domain.com/test.php</pre>
<pre>ab将同时向http://www.domain.com/test.php发出50个并发请求，共发出1000次。</pre>
<pre>有用的信息：</pre>
<pre>
<pre>Requests per second:    75.45 [#/sec] (mean)</pre>
</pre>
<pre>每秒钟可以处理的请求数为75.45个</pre>
<pre>
<ul>
<li>若将请求数增加，看看服务器能否处理更大的压力，需要调节Apache的 <strong>MaxClients、ThreadsPerChild、MaxThreadsPerChild</strong> 等参数，基于httpd.conf中的MPM模块选择。</li>
<li>若本地服务器不是Apache，请使用其它测试方法。</li>
</ul>
</pre>
<pre></pre>
<br><br>想快点找到作者也可以到Twitter上留言: <a href="https://www.twitter.com/54chen" target="_blank">@54chen</a><br>或者你懒得带梯子上墙，请到新浪微博：<a href="http://t.sina.com.cn/54chen" target="_blank">@54chen</a>]]></content:encoded>
			<wfw:commentRss>http://www.54chen.com/php-tech/web%e5%8e%8b%e5%8a%9b%e6%b5%8b%e8%af%95%e5%b7%a5%e5%85%b7%e4%bb%8b%e7%bb%8d.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

