【压测专题】ApacheBenchmark使用说明「安装篇」

安装Apache Benchmark

在下面两节中,我们将介绍如何在基于Windows和Unix的系统上安装运行ab工具所需的文件。

1. Unix和Mac安装

如果用的是*nix操作系统,则会有很多安装Apache的选项。可以通过ports、yum、apt-get安装或只是下载源文件并安装。表1-1显示了安装命令的完整列表。

表1-1 使用存储库来安装Apache Web服务器

存 储 库

命令

yum

yum install apache2

ports

sudo port install apache2

apt-get

apt-get install apache2

Mac用户可以在终端上使用MacPorts并执行表1-1所示的基于ports的命令。

2. Windows安装

Windows用户可在浏览器中打开Welcome! - The Apache HTTP Server Project。加载此页之后,单击页面左侧的"Download from a mirror"(从镜像下载)链接,找到适合你的系统的相应下载程序包,即Windows 32 Binary版本,然后下载。编写本书时,最新的Apache版本为2.2.X。

当程序包下载完之后,就可以通过运行安装向导在系统的任意位置上安装该软件。我将Apache安装在默认位置C:\Program Files\Apache Software Foundation,但也可以安装在系统的任意位置。此处所选择的位置就是APACHE_HOME引用所指向的位置。

现在,打开目录<APACHE_HOME>\Apache2.2\bin。应该可以看到类似于图1-3的文件和目录的集合。

图1-3 安装好后的Windows Apache的bin目录

你已成功安装ab了工具,现在让我们使用它。

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
apache benchmark 独立文件 ab.exe 可以直接使用 Version 2.3。一般用户压力测试用。参数如下 .\ab.exe --help Options are: -n requests Number of requests to perform -c concurrency Number of multiple requests to make at a time -t timelimit Seconds to max. to spend on benchmarking This implies -n 50000 -s timeout Seconds to max. wait for each response Default is 30 seconds -b windowsize Size of TCP send/receive buffer, in bytes -B address Address to bind to when making outgoing connections -p postfile File containing data to POST. Remember also to set -T -u putfile File containing data to PUT. Remember also to set -T -T content-type Content-type header to use for POST/PUT data, eg. 'application/x-www-form-urlencoded' Default is 'text/plain' -v verbosity How much troubleshooting info to print -w Print out results in HTML tables -i Use HEAD instead of GET -x attributes String to insert as table attributes -y attributes String to insert as tr attributes -z attributes String to insert as td or th attributes -C attribute Add cookie, eg. 'Apache=1234'. (repeatable) -H attribute Add Arbitrary header line, eg. 'Accept-Encoding: gzip' Inserted after all normal header lines. (repeatable) -A attribute Add Basic WWW Authentication, the attributes are a colon separated username and password. -P attribute Add Basic Proxy Authentication, the attributes are a colon separated username and password. -X proxy:port Proxyserver and port number to use -V Print version number and exit -k Use HTTP KeepAlive feature -d Do not show percentiles served table. -S Do not show confidence estimators and warnings. -q Do not show progress when doing more than 150 requests -l Accept variable document length (use this for dynamic pages) -g filename Output collected data to gnuplot format file. -e filename Output CSV file with percentages served -r Don't exit on socket receive errors. -m method Method name -h Display usage information (this message)

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

洛神灬殇

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值