files----> keep.data nokeep.data keepalive.output
shell> yum install -y gnuplot ///gnuplot--->画图软件!
shell> ab -k -g /tmp/test/keep.data -n 10000 -c 10000 http://10.1.1.235/template3/index.html
///keepalive on,总并发10000,测试10000次!
shell> ab -g /tmp/test/nokeep.data -n 10000 -c 10000 http://10.1.1.235/template3/index.html
///keepalive off
shell> cd /tmp/test
keep.data nokeep.data keepalive.output
shell> gnuplot keepalive.output
///执行完之后,图片keepalive.png便在当前目录下生成了!然后根据图分析!
--------------------------keepalive.output---------------------------------------
#output as png image
set term png enhanced font '/usr/share/fonts/liberation/LiberationSans-Regular.ttf'
# ls /usr/share/fonts/liberation/LiberationSans-Regular.ttf ==>验证是否有该字体!
#save file to png file
set output "keepalive.png" ///输出图片文件名
#graph title
set title "Lin-credibe" ///图片标题
#nicer aspect ratio for image size
set size 1,0.7
# y-axis grid
set grid y
# x-axis label
set xlabel "request"
#y-axis label
set ylabel "response time (ms)"
plot "keep.data" using 9 smooth sbezier with lines title "usingKeepAlive",
"nokeep.data" using 9 smooth sbezier with lines title "noKeepAlive" //no white space
生成的图片如下: