当前位置:首页 > 谈天说地

ab压力测试命令(在线ddos免费测压平台)

34资源网2021-12-042732

ab 是apache对 http服务器进行压力测试的工具,它可以测试出服务器每秒可以处理多少请求。本文记录mac版本安装 ab 的步骤以及遇到的坑。

下载

进入 apache ab官网 下载页面。

安装

brew 安装

  • 因为笔者的操作系统是mac系统,所以需要先安装brew。进入brew网站。执行下方命令/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"执行命令后报错:Failed to connect to raw.githubusercontent.com port 443: Connection refused解决方案:打开 https://www.ipaddress.com/ 查询 raw.githubusercontent.com 对应的 ip 地址。

添加ip到 /etc/hosts,添加以下配置:

185.199.108.133 raw.githubusercontent.com
185.199.109.133 raw.githubusercontent.com
185.199.110.133 raw.githubusercontent.com
185.199.111.133 raw.githubusercontent.com

再执行

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

执行成功后,使用brew安装apr、apr-util和prce

brew install apr
brew install apr-util
brew inatll prce

apache ab安装

解压下载后压缩包,进入 httpd-2.4.51 目录。执行以下命令:

./configure
make
make install

执行 ./configure 命令时报错:

jeremy@jeremydeMacBook-Pro httpd-2.4.51 % ./configure
checking for chosen layout... Apache
checking for working mkdir -p... yes
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking build system type... x86_64-apple-darwin20.2.0
checking host system type... x86_64-apple-darwin20.2.0
checking target system type... x86_64-apple-darwin20.2.0
configure:
configure: Configuring Apache Portable Runtime library...
configure:
checking for APR... no
configure: error: APR not found.  Please read the documentation.

APR not found 没找到./configure 改成

 ./configure --with-apr=/usr/local/opt/apr --with-apr-util=/usr/local/opt/apr-util --with-pcre=/usr/local/Cellar/pcre/8.45

其中 pcre 的路径可能不同,需要在 /usr/local/Cellar/pcre 里面确定路径。

上述命令执行成功后,如果没有报错,表明安装成功,执行ab

ab: wrong number of arguments
Usage: ab [options] [http[s]://]hostname[:port]/path
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

出现以上界面,说明 ab 已经安装成功。

运行 ab

主要参数

  • -n 请求树
  • -c 并发数(访问人数)
  • -t 请求时间最大数ab -n 1000 -c 100 http://www.baidu.com表示请求baidu.com 使用100请求数,请求1000次。

总结

  • 需要在配置brew和检测configure上花了比较多的时间。
  • 其余的按照步骤即可。

看完文章,还可以扫描下面的二维码下载快手极速版领4元红包

快手极速版二维码

快手极速版新人见面礼

除了扫码领红包之外,大家还可以在快手极速版做签到,看视频,做任务,参与抽奖,邀请好友赚钱)。

邀请两个好友奖最高196元,如下图所示:

快手极速版邀请好友奖励

扫描二维码推送至手机访问。

版权声明:本文由34楼发布,如需转载请注明出处。

本文链接:https://www.34l.com/post/2605.html

分享给朋友:

相关文章

打败你的不一定是你的对手,有可能是一个过路人

打败你的不一定是你的对手,有可能是一个过路人

有句话叫做“羊毛出在狗身上,由猪买单”…

单身想找个女朋友,男的去哪里可以找个女朋友

单身想找个女朋友,男的去哪里可以找个女朋友

现在中国的男女比例失调,男的光棍要比女的多出3000w以上,这是个什么概念?代表着有3000w人是找不到对象的。所以很多单身男的就开始发愁了,单身想找个女朋友究竟到哪里找呢?说实话,小编也是一名单身汉,也正在找女朋友,虽然说,我没有找到女朋…

哪家的云主机好(国内五大云主机服务商)

哪家的云主机好(国内五大云主机服务商)

导言:博睿数据(股票代码688229)十余年专注APM领域,已为超过2000余家大型企业提供专业数据服务。依托先进的测评技术及丰富的行业经验,博睿宏远倾力打造了一个公开透明的性能测评栏目——【Bonree指数】。该栏目致力于呈现各行业的整体…

抖音长视频怎么开通?抖音开通长视频的权限分享

抖音长视频怎么开通?抖音开通长视频的权限分享

经常玩抖音的朋友来说开通抖音1分钟长视频已经不是一件难事了。大家都知道抖音默认视频长度为15秒。只有达到一定要求才可以获得长视频权限。但是现在我们发现能发抖音长视频的朋友越来越多了。他们是怎么做到的呢?抖音怎么发长1分钟视频呢?抖音长视频是…

在爆破产品中内置芯片,「煋邦数码」让爆破产品被精准控制、全程追溯

在爆破产品中内置芯片,「煋邦数码」让爆破产品被精准控制、全程追溯

工业电雷管作为雷管的第二大品种,近几年已逐渐被数码电子雷管取代。 根据《民爆行业经济运行分析报告》显示,2020年工业雷管总产量为9.56亿发,其中电子雷管的产量和占比继续保持着高速增长。从近五年电子雷管产量变化情况看,2020年电子雷管产…

李佳琦:三十而已

李佳琦:三十而已

编者按:本文转自何加盐(ID:ihejiayan),作者何加盐,题图@李佳琦 微博,创业邦经授权转载。 李佳琦,生于1992年5月。 这是我迄今为止,写过的最年轻的商业人物。 按年份来算,他还要过27天,才进入30岁;按生日来算,他还要再过…