-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 toset -T -u putfile File containing data to PUT. Remember also toset -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 infoto 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 Donot show percentiles served table. -S Donot show confidence estimators and warnings. -q Donot 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) -Z ciphersuite Specify SSL/TLS cipher suite (See openssl ciphers) -f protocol Specify SSL/TLS protocol (TLS1, TLS1.1, TLS1.2 or ALL)
1、模拟10个client,总共发送100个请求(每个client发送10个请求) ab -n 100 -c 10 http://localhost/ 注意网址后面要加”/“或者明确的path。 运行结果如下:
Server Software:Apache/2.4.18 Server Hostname:localhost Server Port:80
Document Path:/ Document Length:11321bytes
Concurrency Level:10 Time taken for tests:0.013seconds Complete requests:100 Failed requests:0 Total transferred:1159500bytes HTML transferred:1132100bytes # 相当于LoadRunner中的每秒事务数 Requests per second:7841.29[#/sec](mean) # 相当于LoadRunner中的平均事务响应时间 Time per request:1.275[ms](mean) # 每个连接请求实际运行时间的平均值 Time per request:0.128[ms](mean,acrossallconcurrentrequests) Transfer rate:88788.85[Kbytes/sec]received
The program 'gnuplot' can be found in the following packages: * gnuplot-nox * gnuplot-qt * gnuplot-x11 * gnuplot5-nox * gnuplot5-qt * gnuplot5-x11 Try: sudo apt install <selected package>
1、启动 输入gnuplot,进入gnuplotshell。 这里包含gnuplot的版本、系统、版权等信息。最关键的是最后一条: Terminal type set to ‘unknown’ 什么是terminal?在gnuplot中,terminal就是说你打算用什么方式输出图片。这里默认的terminal是unknown,因为我们安装了gnuplot-nox。一般需要修改为wxt,也就是直接输出到电脑屏幕上。
# output as png image set terminal png size 1000,560 setoutput"throughput.png" #graph title settitle"Throughput" setkey invert reverse Left outside # nicer aspect ratio for image size #setsize 1,0.6 # y-axis grid setgrid y # x-axis label setxlabel"time" # y-axis label setylabel"responses per second" plot "epochtime.dat" using 1:2 with lines title"t10"