Apachelot test performance and use GnuPlot to draw charts

Source: Internet
Author: User

Apache Runtime is a powerful web performance testing tool. However, the output result is only in the numerical form, and data changes are not easy to see. Therefore, GnuPlot's powerful rendering function can make up for Apache compaction's shortcomings.

For the installation and use of apacheab, refer to the simple stress test on installing apache AB commands in ubuntu.


GnuPlot:Http://www.gnuplot.info/download.html

GnuPlot document address:Http://www.gnuplot.info/documentation.html


GnuPlot installation:

tar zxvf gnuplot-4.6.4.tar.gzcd gnuplot-4.6.4./configuresudo make && sudo make install

Usage of GnuPlot:

First, use apacheloud to test the performance and write the test results to a file. We perform three performance tests on 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://localhost/index.phpab -n 500 -c 300 -g ./ab_500_300.dat  http://localhost/index.php
The-g parameter indicates that the test result is exported as a gnuplot file. The results of the three tests are saved in AB _500_100.dat, AB _500_200.dat, and AB _500_300.dat.

The content format of the gnuplot file is as follows:

StarttimesecondsctimedtimettimewaitMon Jan 27 21:03:02 mongojan 27 21:03:02 mongojan 27 21:03:02 mongojan 27 21:03:02 mongojan 27 21:03:02 mongojan 27 21:03:02 mongojan 27 21:03:02 2014139082778210172582623Mon Jan 27 21:03:02 mongojan 27 2 1:03:02 Jan 27 21:03:02 Jan 27 21:03:02 Jan 27 21:03:02 Jan 27 21:03:02 Jan 27 21:03:02 21:03:02 21:03:02 Jan 27 21:03:02 Jan 27 21:03:02 2014139082778210383193423Mon Jan 27 21:03:02 2014139082778210883193936Mon Jan 27 21:03:02 mongojan 27 21:03:02 mongojan 27 21:03:02 mongojan 27 21:03:02 mongojan 27 21:03:02 mongojan 27 21:03:02 mongoj An 27 21:03:02 21:03:02 later than 2014139082778212384396715 is omitted ..

Then, draw a chart based on the exported gnuplot file. The script is as follows:

# Set terminal png # set output image file name set output "AB _500.png" # chart title set title "AB _500 AB-n 500-c 100,200,300" # set the chart format scale the X and Y axes (equivalent to adjusting the aspect ratio of the image, it's hard to see the square.) set size 1, 0.7 # set to draw a grid based on Y axis data (that is, the horizontal dotted line in the example chart) set grid y # X axis title set xlabel "request" # y axis title set ylabel "response time (MS)" # set the data file, curve style, and legend name of the plot, plot "AB _500_100.dat" using 9 smooth sbezr with lines title "conc per 100" Based on the Data ttime in the ninth column ", "AB _500_200.dat" using 9 smooth sbezr with lines title "conc per 200", "AB _500_300.dat" using 9 smooth sbezr with lines title "conc per 300"

Parameter description:

Set size 1, 0.7 zoom ratio, front X axis, followed by Y axis, a floating point number (0, 1], 1 is the original value

Using 9 indicates which column of data is used for plotting. Numbers are numerical indexes of fields separated by spaces or tabs in data rows, starting from 1.

Some data filling algorithms provided by smooth sbetiller plot ensure the smoothness of the line, including the following options: smooth {unique | csplines | acsplines | betilles | sbetilles}. For more information, see the official documentation.

With lines title "xxx", a legend is generated in the upper right corner to identify the color of the line and the data.


The generated 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.