内容: http_load 的使用。
http_laod Version 09Mar2016
http_load 并行运行多个 http 请求,来测试 Web 服务器的吞吐率(throughput)。
和 Apache 的 ab 有点类似,但是比 ab 更加灵活,http_load 支持从文件中读取 URL,也可以按照时间比率进行测试。
http_load 运行在单个进程中,所以不会对客户端机器造成太大压力。它也可以执行 https 请求。
Homepage: https://acme.com/software/http_load/
Download: https://acme.com/software/http_load/http_load-09Mar2016.tar.gz
安装
请阅读源码目录下的 README 文件。SysV-like 的系统,或者使用 SSL 需要修改 Makefile,这两点在 README 中都有讲。
安装,直接执行 make 就可以了,安装并不复杂,执行 make 之后会在源码目录下生成 http_load 文件。
命令行语法
http_load [-checksum] [-throttle] [-proxy host:port] [-verbose] [-timeout secs] [-sip sip_file]
-parallel N | -rate N [-jitter]
-fetches N | -seconds N
url_file
参数解释
以下的选项都可以使用单个字母简写,比如 -checksum 等价 -c。
如果没有使用改选项,只检查字节数。
这些地址被随机用作链接的源地址。这些地址必须是你本机的地址(这个地方读者需要了解以下虚拟网卡,在一台主机上配置多个 IP 地址)。
指定要使用的密码集(cipher set)。默认,http_load 将和 Server 协商使用最安全的密码集(cipher set),这通常比浏览器的协商更高(但是更慢)。
http_load 内置三个密码集(cipher set),可以通过以下关键字访问:
* highsec – high security – DES-CBC3-SHA
* paranoid – ultra high security – AES256-SHA
可同时搭配使用 -jitter,将随机改变 rate,约 10%。
如果使用 -rate,http_load 将尽力以该速率启动连接,但可能不会成功。
如果使用 -parallel,http_load 将尝试保持许多同时连接,但如果 Server 速度非常快,可能无法跟上。
Demo
% http_load -rate 2 -seconds 300 urls
591 fetches, 8 max parallel, 5.33606e+06 bytes, in 300 seconds
9028.87 mean bytes/connection
1.97 fetches/sec, 17786.9 bytes/sec
msecs/connect: 28.8932 mean, 44.243 max, 24.488 min
msecs/first-response: 63.5362 mean, 81.624 max, 57.803 min
HTTP response codes:
使用