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

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

34资源网2021-12-042832

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

分享给朋友:

相关文章

低成本创业好项目,这个可日赚几千元

低成本创业好项目,这个可日赚几千元

这几年创业项目也变得越来越多了,大家都知道,现在靠打工是挣不了什么钱的,所以,很多人宁愿自己创业不想打工。那么,低成本创业项目有哪些呢?下面小编马上为大家推荐一个低成本创业项目,如果你有资源的话,也可以免费去推广操作,做好了日赚几千也是很容…

好想你花开富贵大礼包多少钱一提?1236g优惠价只需要43.90元

好想你花开富贵大礼包多少钱一提?1236g优惠价只需要43.90元

好想你花开富贵大礼包多少钱一提?好想你,花开富贵礼盒1236g零食大礼包,原价58.90元,领取15元的优惠券减掉之后只需要43.90元,这个价格在近30日内属于最低价,喜欢这款商品的朋友不要错过哦。…

初中生创业可以做什么?适合初中生干的创业项目推荐

初中生创业可以做什么?适合初中生干的创业项目推荐

现如今很多初中生因为家里经济条件不是很好,不得已早早的就辍学创业了。那么,初中生创业可以做什么好呢?很多初中生对于刚开始创业很迷糊,不知道该做什么好,接下来小编就给大家推荐几种适合初中生干的创业项目,想创业挣钱的初中生朋友好好看下吧。…

养成良好的习惯,做一名有品位的教师

养成良好的习惯,做一名有品位的教师

陶行知先生说:“思想决定行动,行动养成习惯,习惯形成品质,品质决定命运”。最近从网上读了《影响教师一生的100个好习惯》一书,不禁对陶先生这句话有了更深刻的领悟和理解。阅读本书带给我的不仅是享受,更多的则是生活的引领,智慧的传递和方法的教授…

苹果X快充PD充电器推荐,现在下载还有优惠券可以领呢

苹果X快充PD充电器推荐,现在下载还有优惠券可以领呢

现在有很多人用的是苹果手机,因为平时有些人不注意使用方式或者使用充电器比较频繁导致损坏。大家都知道苹果手机和安卓手机的充电器是不一样的,不能用安卓手机的充电器充苹果手机。所以,大家如果苹果手机充电器损坏了,需要购买的话就要买个专门的苹果手机…