<?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>Apache Bench &#8211; 科技改变生活-雨落星辰</title>
	<atom:link href="https://p1e.cn/html/tag/apache-bench/feed" rel="self" type="application/rss+xml" />
	<link>https://p1e.cn</link>
	<description>所有的伟大,都源于一个勇敢的开始</description>
	<lastBuildDate>Sun, 29 Jan 2023 04:05:00 +0000</lastBuildDate>
	<language>zh-Hans</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.7.2</generator>
	<item>
		<title>CentOS安装Apache Bench进行网站压力测试</title>
		<link>https://p1e.cn/html/3276.html</link>
					<comments>https://p1e.cn/html/3276.html#respond</comments>
		
		<dc:creator><![CDATA[Naoki]]></dc:creator>
		<pubDate>Sun, 29 Jan 2023 04:05:00 +0000</pubDate>
				<category><![CDATA[运维笔记]]></category>
		<category><![CDATA[Apache Bench]]></category>
		<category><![CDATA[Centos]]></category>
		<guid isPermaLink="false">https://www.815494.com/?p=3276</guid>

					<description><![CDATA[ApacheBench （简称ab）是一个指令列程式，可用于网站压力测试。如果已经安装过Apache，会自带ab工具，如果不想安装Apache，又想使用ab命令的可通过下面的方法单独安装ApacheBench 安装 #安装相关依赖 yum -y install apr-util yum -y install yum-utils #创建临时目录 mkdir abtmp &#38;&#38; cd abtmp #安装 yumdownloader httpd-tools* rpm2cpio httpd-tools-*.r]]></description>
										<content:encoded><![CDATA[<p>ApacheBench （简称ab）是一个指令列程式，可用于网站压力测试。如果已经安装过Apache，会自带ab工具，如果不想安装Apache，又想使用ab命令的可通过下面的方法单独安装ApacheBench</p>
<p><img fetchpriority="high" decoding="async" class="alignnone size-full wp-image-3277" src="https://i.p1e.cn/2023/01/blog20230129120323pEAajY.jpg" width="500" height="203" /></p>
<h3>安装</h3>
<pre><code class="bash hljs"><span class="hljs-comment">#安装相关依赖</span>
yum -y install apr-util
yum -y install yum-utils
<span class="hljs-comment">#创建临时目录</span>
mkdir abtmp &amp;&amp; <span class="hljs-built_in">cd</span> abtmp
<span class="hljs-comment">#安装</span>
yumdownloader httpd-tools*
rpm2cpio httpd-tools-*.rpm |cpio -idmv
<span class="hljs-comment">#拷贝</span>
cp usr/bin/ab /usr/bin
</code></pre>
<p>输入上面的命令，一行一个，不出意外的情况下输入<code>ab -V</code>就能查看到相关信息了，如下截图。</p>
<p><img decoding="async" class="alignnone size-full wp-image-3278" src="https://i.p1e.cn/2023/01/blog20230129120326auf742.png" width="526" height="69" /></p>
<h3>网站压力测试</h3>
<p>输入命令<code>ab -n 1000 -c 50 https://www.baidu.com/</code>进行测试，这句话的意思是对www.baidu.com发起1000个请求，并发数为50，常用的参数基本就下面两个：</p>
<ul>
<li>-n：指定测试会话使用的请求数；</li>
<li>-c：指定一次向服务器发出请求数；</li>
</ul>
<p>如果需要查看更多的参数说明，请访问：<a title="ab命令" href="http://man.linuxde.net/ab" target="_blank" rel="nofollow noopener">ab命令</a><br />
通过日志分析，发现刚刚ab命令发送了大量请求过来，如下截图，相当于网站正在遭受小规模的CC攻击。</p>
<p><img decoding="async" class="alignnone size-full wp-image-3279" src="https://i.p1e.cn/2023/01/blog20230129120328KAtAf7.png" width="584" height="457" /></p>
<h3>总结</h3>
<p>ApacheBench可用户网站压力测试，亦可用于发起CC攻击，请不要滥用哦。</p>
<div></div>]]></content:encoded>
					
					<wfw:commentRss>https://p1e.cn/html/3276.html/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
