MAC 安装 apache ab 压力测试工具以及遇到的坑
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上花了比较多的时间。
- 其余的按照步骤即可。
MAC 安装 apache ab 压力测试工具以及遇到的坑的更多相关文章
- [转] CentOS单独安装Apache Benchmark压力测试工具的办法
Apache安装包中自带的压力测试工具 Apache Benchmark(简称ab) 简单易用,这里就采用 ab作为压力测试工具了. 1.独立安装 ab运行需要依赖apr-util包,安装命令为: 1 ...
- apache ab 压力测试工具
Apache的ab命令模拟多线程并发请求,测试服务器负载压力,也可以测试nginx.lighthttp.IIS等其它Web服务器的压力.Apache附带的ab工具(使用的PHP环境是WAMP集成环境, ...
- CentOS7安装使用ab压力测试工具
执行安装命令:yum -y install httpd-tools 安装完毕,执行:ab -help,显示命令参数 命令模板:ab -c 100 -n 10000 待测试网站(建议完整路径) -c 即 ...
- CentOS7单独安装Apache Bench压力测试工具
用于并发测试. 1.安装 # need to run ab,apache portable runtime yum install apr-util # yum install yum-utils # ...
- 4分钟apache自带ab压力测试工具使用: 2015.10.4
2015.10.44分钟apache自带ab压力测试工具使用:win8.1 wampserver2.5 -Apache-2.4.9-Mysql-5.6.17-php5.5.12-64b 可以参考一下部 ...
- win8.1上wamp环境中利用apache自带ab压力测试工具使用超简单讲解
2015.10.4apache自带ab压力测试工具使用:本地环境:win8.1 wampserver2.5 -Apache-2.4.9-Mysql-5.6.17-php5.5.12-64b 可以参考一 ...
- apache ab压力测试报错(apr_socket_recv: Connection reset by peer (104))
apache ab压力测试报错(apr_socket_recv: Connection reset by peer (104)) 今天用apache 自带的ab工具测试,当并发量达到1000多的时 ...
- apache ab压力测试报错apr_socket_recv
apache ab压力测试报错(apr_socket_recv: Connection reset by peer (104)) apache 自带的ab工具测试,当并发量达到1000多的时候报错如下 ...
- Apache中压力测试工具ab的操作说明
1.压力测试工具ab(ApacheBench)的简单说明 1) 网站性能压力测试是性能调优过程中必不可少的一环.只有让服务器处在高压情况下才能真正体现出各种设置所暴露的问题.Apache中有个 ...
随机推荐
- .Net Core配置Configuration源码研究
最近又研究了一下.NetCore配置选项的源码实现,又学习到了不少东西.这篇文章先写一下IConfiguration的学习成果,Options的后面补上 核心类 ConfigurationBuilde ...
- noip模拟18
\(\color{white}{\mathbb{曲径通幽,星汉隐约,缥缈灯影,朦胧缺月,名之以:薄雾}}\) 放眼望去前十被我弃掉的 \(t2\) 基本都上85了-- 开考就以为 \(t2\) 是个大 ...
- GDB调试:Linux开发人员必备技能
开篇词:Linux C/C++ 开发人员要熟练掌握 GDB 调试 大家好,我是范蠡,目前在某知名互联网旅游公司基础框架业务部技术专家组任开发经理一职. 本系列课程的主题是 Linux 后台开发的 C/ ...
- ubuntu14.04 安装MySQL 5.7
ubuntu14.04 默认在线安装MySQL 5.5 1) wget http://dev.mysql.com/get/mysql-apt-config_0.7.3-1_all.deb 2) dpk ...
- uniapp 获取用户手机号
参考资料: 微信小程序官方文档 uniapp开发微信小程序获取用户手机号 页面增加一个按钮 <button open-type="getPhoneNumber" @getph ...
- IDEA创建Maven项目做Java Web时无WEB-INF/classes的问题
昨天开始学习Java Web中的Servlet,学到用IntelliJ IDEA创建Java Web项目时,跟着课程上老师的步骤一步步做,却发现运行时Servlet找不到.坑爹的是,练习建项目时,一模 ...
- shell脚本———双重循环——九九乘法表
1.基础双重循环模板 2.break跳出单个循环 3.continue中止某次循环中的命令,但不会完全中止整个命令 4.九九乘法表
- Jetpack Compose学习(4)——Image(图片)使用及Coil图片异步加载库使用
原文地址 Jetpack Compose学习(4)--Image(图片)使用及Coil图片异步加载库使用 | Stars-One的杂货小窝 本篇讲解下关于Image的使用及使用Coil开源库异步加载网 ...
- Vue中使用 iview 之-踩坑日记
导航列表: 一.iview单选框Select验证问题 二.iview表单v-if引起的问题 三.Upload 手动上传组件 使用是出现的问题 四.Tabs嵌套使用时的问题 五.Tooltip 换行问题 ...
- Markdown主要语法及使用
最近,我发现使用Markdown这一标记语言的人越来越多了,我也去试了一下,感觉确实在编辑文档上方便了很多.于是我将一些关于Markdown的语法和编写时的快捷键整理在这里,方便以后查阅,也欢迎评论区 ...