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

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

34资源网2021-12-042889

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

分享给朋友:

相关文章

创业做什么好成本低?又赚钱呢?做这6个成本低又赚钱多

创业做什么好成本低?又赚钱呢?做这6个成本低又赚钱多

现如今想创业的人还是很多的,大家都不想给别人打工,都想自己创业赚钱。当今是一个人人可以创业的时代,越来越多的人走上创业致富之路。那么,创业做什么好成本低呢?下面,小编给大家整理了6种适合创业的低成本创业项目,大家一起来看看吧。1、烧烤摊近几…

女人奋斗励志语录分享10句

女人奋斗励志语录分享10句

1、即便无人喝彩,也要守住自己的人生。每一次失败,都是成功的伏笔;每一次考验,都有一份收获;每一次泪水,都有一次醒悟;每一次磨难,都有生命的财富。每一次伤痛,都是成长的支柱。…

卡斯数据是干什么的(免费大数据查询平台)

卡斯数据是干什么的(免费大数据查询平台)

短视频/直播电商不负众望,成为2020年品牌营销最热关键词。G2格局下两大顶流——抖音和快手,也自然吸引了各方关注。相较抖音而言,快手独特的老铁氛围像自带结界,不懂“规矩”的内容创作者和品牌方在这里寸步难行。 究竟快手直播电商现状如何?什么…

g系列cpu性能排行(英特尔u系列和g系列)

g系列cpu性能排行(英特尔u系列和g系列)

去年10月,AMD正式发布Zen 3架构锐龙5000系列处理器,单线程和多线程性能实现“质”的飞跃,反超当时的10代酷睿处理器,与后来发布的11代酷睿处理器相比,也丝毫不落于下风。 在这样的大前提下,AMD于4月发布了Zen 3架构锐龙5…

mac地址的作用是什么(理解mac地址的作用实验报告)

mac地址的作用是什么(理解mac地址的作用实验报告)

我们上网时会发现电子设备同时有IP地址和MAC地址,为什么上网会需要两个地址呢?…