Fork me on GitHub

压力测试工具httperf使用方法

压力测试工具httperf使用方法

ftp://ftp.hpl.hp.com/pub/httperf/

下载后放到linux的/usr/local/src目录下

通过tar zxvf解压httperf-0.9.0.tar.gz

cd usr/local/src
tar zxvf httperf-0.9.0.tar.gz

进入目录

cd httperf-0.9.0

安装c++编译环境

yum install -y ncurses-devel libaio-devel cmake gcc gcc-c++ glibc

开始编译

./configure --prefix=/usr/local/httperf
make && make install

进入编译后的bin目录

cd /usr/local/httperf/bin

开始测试

./httperf --client=0/1 --server ip或域名 --port 8080 --uri /user --num-conns 30000 --rate 30000 --hog

--client=I/N 指定当前客户端I,是N个客户端中的第几个。用于多个客户端发请求,希望确保每个客户端发的请求不是完全一致。一般不用指定

• --server 所测试的的网站名(主机名,域名或者ip地址)

• --uri 指定的下载文件

• --rate 每秒发送的请求

• --num-conn 连接的总数

• --num-call 每个连接发送的请求数目

• --timeout 超时时间

实例:
[root@192 bin]# ./httperf --client=0/1 --server guixiang.top --port 8080 --uri /user --num-conns 30000 --rate 30000 --hog
httperf --hog --client=0/1 --server=guixiang.top --port=8080 --uri=/user --rate=30000 --send-buffer=4096 --recv-buffer=16384 --num-conns=30000 --num-calls=1
httperf: warning: open file limit > FD_SETSIZE; limiting max. # of open files to FD_SETSIZE
httperf: connection failed with unexpected error 113
^[[A^CMaximum connect burst length: 6347

Total: connections 1021 requests 0 replies 0 test-duration 93.509 s

Connection rate: 10.9 conn/s (91.6 ms/conn, <=1022 concurrent connections)
Connection time [ms]: min 0.0 avg 0.0 max 0.0 median 0.0 stddev 0.0
Connection time [ms]: connect 41076.2
Connection length [replies/conn]: 0.000

Request rate: 0.0 req/s (0.0 ms/req)
Request size [B]: 0.0

Reply rate [replies/s]: min 0.0 avg 0.0 max 0.0 stddev 0.0 (18 samples)
Reply time [ms]: response 0.0 transfer 0.0
Reply size [B]: header 0.0 content 0.0 footer 0.0 (total 0.0)
Reply status: 1xx=0 2xx=0 3xx=0 4xx=0 5xx=0

CPU time [s]: user 7.38 system 86.08 (user 7.9% system 92.1% total 99.9%)
Net I/O: 0.0 KB/s (0.0*10^6 bps)

Errors: total 29999 client-timo 0 socket-timo 0 connrefused 970 connreset 0
Errors: fd-unavail 28979 addrunavail 0 ftab-full 0 other 50

注意113是因为防火墙原因

关了之后:
[root@192 bin]# ./httperf --client=0/1 --server 192.168.117.170 --port 8080 --uri /user --num-conns 30000 --rate 30000 --hog
httperf --hog --client=0/1 --server=192.168.117.170 --port=8080 --uri=/user --rate=30000 --send-buffer=4096 --recv-buffer=16384 --num-conns=30000 --num-calls=1
httperf: warning: open file limit > FD_SETSIZE; limiting max. # of open files to FD_SETSIZE
Maximum connect burst length: 13605

Total: connections 2552 requests 0 replies 0 test-duration 1.009 s

Connection rate: 2528.6 conn/s (0.4 ms/conn, <=1022 concurrent connections)
Connection time [ms]: min 0.0 avg 0.0 max 0.0 median 0.0 stddev 0.0
Connection time [ms]: connect 213.7
Connection length [replies/conn]: 0.000

Request rate: 0.0 req/s (0.0 ms/req)
Request size [B]: 0.0

Reply rate [replies/s]: min 0.0 avg 0.0 max 0.0 stddev 0.0 (0 samples)
Reply time [ms]: response 0.0 transfer 0.0
Reply size [B]: header 0.0 content 0.0 footer 0.0 (total 0.0)
Reply status: 1xx=0 2xx=0 3xx=0 4xx=0 5xx=0

CPU time [s]: user 0.01 system 0.99 (user 1.4% system 98.3% total 99.7%)
Net I/O: 0.0 KB/s (0.0*10^6 bps)

Errors: total 30000 client-timo 0 socket-timo 0 connrefused 2552 connreset 0
Errors: fd-unavail 27448 addrunavail 0 ftab-full 0 other 0

posted @ 2024-07-19 18:21  guixiang  阅读(5)  评论(0编辑  收藏  举报
1