Apachebench How to test performance and draw a chart using gnuplot

Source: Internet
Author: User
Tags documentation

The Apache bench is a powerful tool for Web performance testing. But the output is only a numerical form, it is not easy to see the data changes. Therefore, Gnuplot's powerful rendering function just can make up for the problem of Apache bench.

About the installation and use of Apachebench can refer to my previous written in the "Ubuntu install Apache AB command for simple stress test"

GnuPlot Download Address: http://www.gnuplot.info/download.html

GnuPlot Document Address: http://www.gnuplot.info/documentation.html

Installation of gnuplot:

Tar zxvf gnuplot-4.6.4.tar.gz  
cd gnuplot-4.6.4  
./configure  
sudo make && sudo make install

Use of gnuplot:

First, using Apachebench test performance and writing the test results to the file, we performed three performance tests on the http://localhost/index.php respectively.

Ab-n 500-c 100-g/ab_500_100.dat http://localhost/index.php ab-n 500-c 200-g   
./ab_500_200.dat Http://localh  ost/index.php  
ab-n 500-c 300-g./ab_500_300.dat  http://localhost/index.php

Parameter-G indicates that the test results are exported to a gnuplot file, and the results of the three tests are saved in Ab_500_100.dat,ab_500_200.dat,ab_500_300.dat.

The gnuplot file content format is as follows:

StartTime seconds CTime dtime ttime wait Mon all 21:03:02 2014 1390827782 503 27 21 : 03:02 2014 1390827782 591 676-Mon, 21:03:02, 2014, 1390827782, 616 710 Mon 27 21:03:02 2 014 1390827782 628 722 Mon 21:03:02 2014 1390827782 741 27 21:03:02 2014 1 390827782 741 825 Mon A 139082778-21:03:02-2014-1390827782-725-826-27 21:03:02 2014 2 124 707 831 Mon, 21:03:02 2014 1390827782 204 629 833 Mon 27 21:03:02 2014 1390827782 95 7 836 Mon 21:03:02 1390827782 2014 743 838-Mon 27 21:03:02 2014 1390827782 96 744 840 4 0 Mon 21:03:02 2014 1390827782 109 773 883 Mon 21:03:02 2014 1390827782 21:03:02 2014 1390827782 153 765 918 Wuyi Mon 2 21:03:02 2014 1390827782 778 1:03:02 2014 13908277814 929 Mon 21:03:02 2014 1390827782 831 934 to Mon 27 21:03:02 2014 1390827782 103 831 934 Mon 21:03:02 2014 1390827782 108 831 939 Mon 27 21:03:02 2014 1390827782 115 825 940  Mon 21:03:02 2014 1390827782 162 783 945 Mon 21:03:02 2014 1390827782 119 21:03:02 2014 1390827782 108 844 952 Mon 21:03:02 2014 1390827782 128 830 958 27  21:03:02 2014 1390827782 128 831 958 Mon 21:03:02 2014 1390827782 108 856 27 21:03:02 2014 1390827782 123 843 967 15 back omitted.

This column more highlights: http://www.bianceng.cnhttp://www.bianceng.cn/webkf/tools/

Then, drawing the chart from the exported gnuplot file, draw the script as follows:

# Set the format of the output picture  
set terminal png  
      
# Set Output picture file name  
set outputs "Ab_500.png"  
      
# Chart title  
set title "Ab_500 Ab-n 500 -C 100,200,300 "  
      
# Set the x and Y axes of the chart (equivalent to adjusting the vertical and horizontal proportions of the picture, the square looks bad) set  
size 1,0.7  
      
# Sets the grid as the datum of y-axis (the horizontal dotted line in the sample chart) Set  
grid y  
      
# x Axis title  
set Xlabel "Request"  
      
# Y axis title  
set Ylabel "Response Time (ms)"  
      
# set plot data file , Curve style, and legend name, with the Nineth column data ttime as datum drawing  
plot "Ab_500_100.dat" using 9 smooth Sbezier with lines title "Conc per", "ab_500_2 00.dat ' using 9 smooth sbezier with lines title ' Conc per ', ' ab_500_300.dat ' using 9 smooth sbezier with lines title ' C Onc per 300 "

Parameter description:

Set size 1,0.7 scaling, preceded by an x axis, followed by a Y axis, a floating-point number (0, 1], 1 is the original value

Using 9 indicates which column of data is plotted, and the number is the numeric index of the field that the data row is divided by space or tab, starting with 1

Smooth Sbezier plot provides some data-filling algorithms to ensure line smoothness, including the following options: Smooth {unique | csplines | acsplines | bézier | sbezier}, please refer to the official documentation for more detailed explanation.

With lines title "XXX" This will then generate a legend in the upper-right corner to distinguish what color line is the data

The resulting chart is as follows:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.