下載壓力測試工具webbench php
wget http://home.tiscali.cz/~cz210552/distfiles/webbench-1.5.tar.gz
安裝依賴包web
yum -y install ctags
注:這個包沒裝會報下面錯誤服務器
cc -Wall -ggdb -W -O -c -o webbench.o webbench.c ctags *.c /bin/sh: ctags: command not found make: [tags] Error 127 (ignored) webbench.c: In function ‘alarm_handler’: webbench.c:77: warning: unused parameter ‘signal’ cc -Wall -ggdb -W -O -o webbench webbench.o
安裝webbench工具
tar -zxvf webbench-1.5.tar.gz -C /usr/local/webbench
make && make install
注:make && make install 的時候報下面的錯 執行 mkdir -p /usr/local/man/man1測試
cc -Wall -ggdb -W -O -c -o webbench.o webbench.c webbench.c: In function ‘alarm_handler’: webbench.c:77: warning: unused parameter ‘signal’ cc -Wall -ggdb -W -O -o webbench webbench.o ctags *.c install -s webbench /usr/local/bin install -m 644 webbench.1 /usr/local/man/man1 install: cannot create regular file `/usr/local/man/man1': No such file or directory make: *** [install] Error 1
添加環境變量spa
export PATH=/usr/local/webbench:${PATH}
參數介紹代理
webbench [option]... URL -f|--force 不等待服務器應答 -r|--reload 生新發送請求 -t|--time <sec> 運行時間 -p|--proxy <server:port> 使用代理服務器 -c|--clients <n> 請求數 -9|--http09 使用http/0.9模式 -1|--http10 使用http/1.0模式 -2|--http11 使用http/1.1模式 --get 使用get的模式請求 --head 使用head模式請求 --options 使用options模式請求 --trace 使用trace模式請求 -?|-h|--help 幫助
用法code
#模擬100次請求,持續時間5秒的壓力測試
webbench -c 100 -t 5 http://localhost/index.php Webbench - Simple Web Benchmark 1.5 Copyright (c) Radim Kolar 1997-2004, GPL Open Source Software. Benchmarking: GET http://localhost/index.php 100 clients, running 5 sec. Speed=96804 pages/min, 88496336 bytes/sec. Requests: 8067 susceed, 0 failed.
--每秒鐘響應請求數:Speed=96804 pages/minserver
--每秒鐘傳輸數據量:88496336 bytes/secblog
--8067次返回正常
--0 次失敗