官网下载 Apache HTPP Server
http://httpd.apache.org/download.cgi#apache24
安装工具
安装 apr
终端 执行 brew install apr , 注意提示 , 并按照提示操作
echo ‘export PATH="/usr/local/opt/apr/bin:$PATH"’ >> ~/.bash_profile
安装 apr-util
终端 执行 brew install apr-util , 注意提示 , 并按照提示操作
echo ‘export PATH="/usr/local/opt/apr-util/bin:$PATH"’ >> ~/.bash_profile
安装 pcre
终端 执行 brew install pcre
source ~/.bash
安装 httpd
进入 httpd-2.4.39 目录
依次执行命令:
./configure
sudo make
sudo make install
安装成功,我们测试下工具
1、使用命令 :
ab -n 请求数 -c 并发数 请求url
如 :
ab -n 100 -c 10 https://www.baidu.com/
意思:发起20个请求,在同一时刻并发10个请求
2、参数
// apache版本信息
This is ApacheBench, Version 2.3 <$Revision: 1826891 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking www.baidu.com (be patient)…..done
// 请求返回header类型
Server Software: BWS/1.1
// 请求ip或者域名
Server Host