Mac系统上安装AB工具

Mac系统上安装AB工具

一、官网下载 Apache HTPP Server

http://httpd.apache.org/download.cgi#apache24

截图.png

二、安装工具

  • 安装 apr
    终端 执行 brew install apr 打印如下信息:
apr is keg-only, which means it was not symlinked into /usr/local,
because Apple's CLT package contains apr.

If you need to have apr first in your PATH run:
  echo 'export PATH="/usr/local/opt/apr/bin:$PATH"' >> ~/.bash_profile

==> Summary
🍺  /usr/local/Cellar/apr/1.7.0: 59 files, 1.4MB

注意提示:If you need to have apr first in your PATH run: echo 'export PATH="/usr/local/opt/apr/bin:$PATH"' >> ~/.bash_profile

所以我们到再执行下 echo 'export PATH="/usr/local/opt/apr/bin:$PATH"' >> ~/.bash_profile

  • 安装 apr-util
    终端 执行 brew install apr-util 打印如下信息,同样注意提示:If you need to have apr-util first in your PATH run: echo 'export PATH="/usr/local/opt/apr-util/bin:$PATH"' >> ~/.bash_profile

于是我们再执行 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

安装成功,我们测试下工具。执行 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:        153651 bytes

Concurrency Level:      1
Time taken for tests:   0.826 seconds
Complete requests:      1
Failed requests:        0
Total transferred:      154625 bytes
HTML transferred:       153651 bytes
Requests per second:    1.21 [#/sec] (mean)
Time per request:       825.589 [ms] (mean)
Time per request:       825.589 [ms] (mean, across all concurrent requests)
Transfer rate:          182.90 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:       23   23   0.0     23      23
Processing:   803  803   0.0    803     803
Waiting:       56   56   0.0     56      56
Total:        826  826   0.0    826     826

安装成功~

推荐阅读更多精彩内容