ab命令介绍

韵味老鸟 2024-08-10 13:13:19

ab 命令介绍

Apache服务器的性能测试工具

root@uk8s:~# ab

找不到命令 “ab”,但可以通过以下软件包安装它:

apt install apache2-utils

root@uk8s:~# apt install apache2-utils

root@uk8s:/# apt install apache2-utils正在读取软件包列表... 完成正在分析软件包的依赖关系树... 完成正在读取状态信息... 完成 将会同时安装下列软件: libapr1 libaprutil1下列【新】软件包将被安装: apache2-utils libapr1 libaprutil1升级了 0 个软件包,新安装了 3 个软件包,要卸载 0 个软件包,有 97 个软件包未被升级。需要下载 290 kB 的归档。解压缩后会消耗 994 kB 的额外空间。您希望继续执行吗? [Y/n] y获取:1 http://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy-updates/main amd64 libapr1 amd64 1.7.0-8ubuntu0.22.04.1 [108 kB]获取:2 http://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy-updates/main amd64 libaprutil1 amd64 1.6.1-5ubuntu4.22.04.2 [92.8 kB]获取:3 http://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy-updates/main amd64 apache2-utils amd64 2.4.52-1ubuntu4.12 [89.1 kB]已下载 290 kB,耗时 3秒 (102 kB/s) 正在选中未选择的软件包 libapr1:amd64。(正在读取数据库 ... 系统当前共安装有 124644 个文件和目录。)准备解压 .../libapr1_1.7.0-8ubuntu0.22.04.1_amd64.deb ...正在解压 libapr1:amd64 (1.7.0-8ubuntu0.22.04.1) ...正在选中未选择的软件包 libaprutil1:amd64。准备解压 .../libaprutil1_1.6.1-5ubuntu4.22.04.2_amd64.deb ...正在解压 libaprutil1:amd64 (1.6.1-5ubuntu4.22.04.2) ...正在选中未选择的软件包 apache2-utils。准备解压 .../apache2-utils_2.4.52-1ubuntu4.12_amd64.deb ...正在解压 apache2-utils (2.4.52-1ubuntu4.12) ...正在设置 libapr1:amd64 (1.7.0-8ubuntu0.22.04.1) ...正在设置 libaprutil1:amd64 (1.6.1-5ubuntu4.22.04.2) ...正在设置 apache2-utils (2.4.52-1ubuntu4.12) ...正在处理用于 man-db (2.10.2-1) 的触发器 ...正在处理用于 libc-bin (2.35-0ubuntu3.8) 的触发器 ...Scanning processes... Scanning linux images... Running kernel seems to be up-to-date.No services need to be restarted.No containers need to be restarted.No user sessions are running outdated binaries.No VM guests are running outdated hypervisor (qemu) binaries on this host.选项root@uk8s:/# abab: wrong number of argumentsUsage: ab [options] [http[s]://]hostname[:port]/pathOptions 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 -x attributes String to insert as table attributes -y attributes String to insert as tr attributes -z attributes String to insert as td or th attributes -C attribute Add cookie, eg. 'Apache=1234'. (repeatable) -H attribute Add Arbitrary header line, eg. 'Accept-Encoding: gzip' Inserted after all normal header lines. (repeatable) -A attribute Add Basic WWW Authentication, the attributes are a colon separated username and password. -P attribute Add Basic Proxy Authentication, the attributes are a colon separated username and password. -X proxy:port Proxyserver and port number to use -V Print version number and exit -k Use HTTP KeepAlive feature -d Do not show percentiles served table. -S Do not show confidence estimators and warnings. -q Do not show progress when doing more than 150 requests -l Accept variable document length (use this for dynamic pages) -g filename Output collected data to gnuplot format file. -e filename Output CSV file with percentages served -r Don't exit on socket receive errors. -m method Method name -h Display usage information (this message) -I Disable TLS Server Name Indication (SNI) extension -Z ciphersuite Specify SSL/TLS cipher suite (See openssl ciphers) -f protocol Specify SSL/TLS protocol (SSL2, TLS1, TLS1.1, TLS1.2 or ALL) -E certfile Specify optional client certificate chain and private key

0 阅读:6