mac自带的apache中的ab是有最大并发限制的,所以我们要重新下载一个apache并且编译。
httpd依赖于apr, apr-util, pcrc,所用得先安装这三个,在安装httpd。
下载地址:
httpd:http://httpd.apache.org/download.cgi
apr和apr-util:http://apr.apache.org/download.cgi
pcrc(不要下载pcre2):https://ftp.pcre.org/pub/pcre/
安装步骤:
1.提前建好编译目录(不是解压目录):
apache: /usr/local/httpd/
apr: /usr/local/apr/
apr-util: /usr/local/apr-util/
pcre: /usr/local/pcre/
2.安装:
(1)先进入下载目录,分别解压这三个安装包:tar -zxvf 包名
(2)进入解压后的安装包目录里,先安装apr,在安装apr-util,再安装pcre。
#进入apr解压目录
#这里的--prefix参数就是要编译到的路径
./configure --prefix=/usr/local/apr
make
make install
=========分割线============
#进入apr-util解压目录,这个安装包依赖apr
./configure --prefix=/usr/local/apr-util -with-apr=/usr/local/apr/
make
make install
=========分割线============
#进入pcre解压目录
./configure --prefix=/usr/local/pcre
make
make install
(3)安装httpd
#进入到apache的解压目录
./configure --prefix=/usr/local/httpd/ -with-apr=/usr/local/apr -with-apr-util=/usr/local/apr-util/ -with-pcre=/usr/local/pcre/
make
make install
3.安装成功,测试下工具。
执行 ab -n 1 -c 1 http://www.baidu.com/
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
Server Software: BWS/1.1
Server Hostname: www.baidu.com
Server Port: 80
Document Path: /
Document Length: 153841 bytes
Concurrency Level: 1
Time taken for tests: 0.043 seconds
Complete requests: 1
Failed requests: 0
Total transferred: 154803 bytes
HTML transferred: 153841 bytes
Requests per second: 23.40 [#/sec] (mean)
Time per request: 42.742 [ms] (mean)
Time per request: 42.742 [ms] (mean, across all concurrent requests)
Transfer rate: 3536.91 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 5 5 0.0 5 5
Processing: 38 38 0.0 38 38
Waiting: 7 7 0.0 7 7
Total: 43 43 0.0 43 43