Three kinds of pressure test tools Http_load and Apache AB, Siege pressure test (turn)

Source: Internet
Author: User
Tags install openssl openssl server port

Find a good descriptive article when testing site performance

From:http://blog.csdn.net/lyflower/archive/2010/09/09/5873544.aspx

To http://www.acme.com/software/http_load/download Http_load, installation is also very simple direct make;make instlall on the line.

Two examples of the standard of the http_load are:

Http_load-parallel 5-fetches 1000 Urls.txt
Http_load-rate 2-seconds Urls.txt
The example is just a reference, the parameters can actually be combined freely, the choice between parameters is not limited. For example, you write Http_load-parallel 5-seconds urls.txt is also possible. Let's give you a brief account of the parameters. -parallel-P: Meaning is the number of concurrent user processes.

-fetches-F: Meaning is the total number of visits

-rate-P: Meaning is the frequency of access per second

-seconds-S: Meaning is the total access time

Urls.txt is a list of URLs, a single row for each URL. Of course, you can also directly follow a URL rather than a URL list file.
Instance:

Http_load-rate 5-seconds URLs
Fetches, 2 max parallel, 289884 bytes, in 10.0148 seconds
5916 mean Bytes/connection
4.89274 fetches/sec, 28945.5 bytes/sec
msecs/connect:28.8932 mean, 44.243 max, 24.488 min
msecs/first-response:63.5362 mean, 81.624 max, 57.803 min
HTTP Response Codes:
Code 200-49
Analysis:
1. Fetches, 2 max parallel, 289884 bytes, in 10.0148 seconds
Description 49 requests were run in the above test, the maximum number of concurrent processes is 2, the total data transfer is 289884bytes, the time is 10.0148 seconds

2. 5916 mean Bytes/connection
Indicates the average amount of data transmitted per connection 289884/49=5916

3. 4.89274 fetches/sec, 28945.5 bytes/sec
Indicates that the response request per second is 4.89274, and the data passed per second is 28945.5 bytes/sec

4. msecs/connect:28.8932 mean, 44.243 max, 24.488 min
The average response time for each connection is 28.8932 msecs, maximum response time 44.243 msecs, minimal response time 24.488 msecs

5. msecs/first-response:63.5362 mean, 81.624 max, 57.803 min

6, HTTP response Codes:code 200-49
Explains the type of open response page, and if 403 is too large, you might want to be aware that the system is experiencing a bottleneck.
Special Note: Here, we will generally pay attention to the indicators are fetches/sec, msecs/connect
They correspond to the commonly used performance metric parameters qpt-per second and response time, per connection response user times. The result of the test is mainly to look at these two values. Of course, only these two indicators can not complete the analysis of performance, we also need to the server's CPU, men analysis, in order to draw conclusions

Sample Run:

%/http_load-rate 5-seconds URLs

Fetches, 2 max parallel, 289884 bytes, in 10.0148 seconds

5916 mean Bytes/connection

4.89274 fetches/sec, 28945.5 bytes/sec

msecs/connect:28.8932 mean, 44.243 max, 24.488 min

msecs/first-response:63.5362 mean, 81.624 max, 57.803 min

HTTP Response Codes:

Code 200-49

4.89274 Fetches/sec This is worth it. The number of queries that the server can respond to per second is around 4.8

This deserves to be based on fetches/

10.0148 seconds seconds to figure out

Test the average number of visits per second the site can withstand
Http_load-parallel 5-fetches 1000 Urls.txt

This command line uses 5 processes simultaneously, randomly accesses the list of URLs in Urls.txt, and accesses a total of 1000 times. Results after the run:

1000 fetches, 5 max parallel, 6e+06 bytes, in 58.1026 seconds
6000 mean Bytes/connection
17.2109 fetches/sec, 103266 bytes/sec
msecs/connect:0.403263 mean, 68.603 max, 0.194 min
msecs/first-response:284.133 mean, 5410.13 max, 55.735 min
HTTP Response Codes:
Code 200-1000

From the results above, the target site can only withstand 17 visits per second, not strong enough.

Test whether the site can withstand the expected access pressure
Http_load-rate 2-seconds Urls.txt

Maintain a certain frequency within 300 seconds to access the target URL.

If you need to test HTTPS, you must put the makefile
# configure:if you want to compile in support for HTTPS, uncomment
# definitions. You'll need to have already built OpenSSL, available at
# http://www.openssl.org/Make sure the Ssl_tree definition points to the
# Tree and your OpenSSL installation–depending on how do you installed it,
# It may be in/usr/local instead of/usr/local/ssl.
Ssl_tree =/usr
Ssl_defs =-duse_ssl
Ssl_inc =-i$ (ssl_tree)/include
Ssl_libs =-l$ (ssl_tree)/lib-lssl-lcrypto

Due to the use of OpenSSL, you must install OpenSSL and the corresponding development environment

Apt-get Install OpenSSL
Apt-get Install Libssl-dev

Find-name ssl.h
/usr/include/openssl/ssl.h

So the Red font section above must be modified

Http_load FAQ
Common use of http_load process in some of the summary, share out, we can add together;

1. Hint: bytes count wrong
If Httpd_load gets the page data and the last inconsistency, it will error byte count wrong
If it is a dynamic page, this error can be ignored;

2. Error: Too many open files
System limited open files are too small, ulimit-n modify the open files value;

3. Unable to send large request (request length >600 characters)
Default BUF size to accept requests HTTP_LOAD.C

912 static void
913 handle_connect (int cnum, struct timeval* nowp, int double_check)
914 {
915 int url_num;
916 Char buf[600]; Modify as needed, such as: Char buf[4096]
917 int bytes, r;

Recompile to get a large request to send

4.Cannot Assign requested Address
Client frequent server, because each connection in a very short period of time, resulting in a lot of time_wait, so that the use of the available port number, so the new connection can not bind the port, so to change the configuration of the client machine,
In sysctl.conf Riga:

Net.ipv4.tcp_tw_reuse = 1 means to turn on reuse. Allows time-wait sockets to be re used for a new TCP connection, which defaults to 0, indicating shutdown;
Net.ipv4.tcp_timestamps=1 turns on support for TCP timestamps, if the entry is set to 0, one of the following settings
Doesn't work
Net.ipv4.tcp_tw_recycle=1 indicates fast recovery of time-wait sockets in TCP connection
Apache AB pressure test

Having previously installed Apache always didn't know how to test Apache performance, now I finally found a test tool. is Apache's own test tool AB (Apache benchmark). In the Apache Bin directory.

Format:./ab [Options] [http://]hostname[:p Ort]/path
Parameters:
-N requests number of requests to perform
The number of requests that were executed in the test session. By default, only one request is executed
-c concurrency number of multiple requests to make
The number of requests produced at a time. The default is one at a time.
-T TimeLimit Seconds to Max. Wait for responses
The maximum number of seconds that the test was made. Its intrinsic implied value is-n 50000. It can limit the testing of the server to a fixed total time. By default, there is no time limit.
-P postfile File containing data to POST
A file that contains the data that needs to be post.
-T Content-type content-type header for POSTing
The Content-type header information used by the post data.
-V verbosity how much troubleshooting info to print
Set the level of detail for display information –4 or larger values display header information, 3 or greater values can display response codes (404, 200, etc.), and 2 or greater values can display warnings and other information. -V Displays the version number and exits.
-W Print out results in HTML tables
Output the results in an HTML table format. By default, it is a table with two columns of white background width.
-I use head instead of
Executes the head request 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)
-C Cookie-name=value attach a cookie to the request: line. The typical form is a parameter pair of Name=value. This parameter can be repeated.
-H attribute Add arbitrary header line, eg. ' Accept-encoding:gzip '
Inserted after the 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.
-P Proxy-auth-username:password provides basic authentication trust to a relay agent. The username and password are separated by one: and sent in the form of a base64 encoding. This string is sent regardless of whether the server needs to (that is, whether the 401 authentication requirement code is sent).
-X Proxy:port ProxyServer and port number to use
-V Print version number and exit
-K Use HTTP KeepAlive feature
-D don't show percentiles served table.
-S don't show confidence estimators and warnings.
-G filename Output collected data to gnuplot format file.
-e filename Output CSV file with percentages served
-H Display Usage information (this message)
-attributes the string that sets the property. There are a variety of statically declared fixed-length buffers in the flaw program. In addition, parsing of command-line arguments, server response headers, and other external input is simple, which can have undesirable consequences. It does not realize http/1.x completely; Only some ' expected ' response formats are accepted. The frequent use of STRSTR (3) can cause performance problems, that is, you may be testing AB rather than server performance.

A lot of parameters, generally we use the-C and-n parameters on it. For example:

./ab-c 1000-n 1000 http://127.0.0.1/index.php

This means processing 1000 requests at a time and running 1000 index.php files.
#/usr/local/xiaobai/apache2054/bin/ab-c 1000-n 1000 http://127.0.0.1/index.html.zh-cn.gb2312
This is apachebench, Version 2.0.41-dev < $Revision: 1.121.2.12 $> apache-2.0
Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright (c) 1998-2002 the Apache Software Foundation, http://www.apache.org/

Benchmarking 127.0.0.1 (Be patient)
Completed Requests
Completed Requests
Completed Requests
Completed Requests
Completed Requests
Completed Requests
Completed Requests
Completed Requests
Completed 900 Requests
Finished 1000 requests

Server software:apache/2.0.54
Platform Apache version 2.0.54
Server hostname:127.0.0.1
Server Host Name
Server port:80
Server port

Document Path:/index.html.zh-cn.gb2312
The page document for the test
Document length:1018 bytes
Document size

Concurrency level:      1000
//concurrency number
time taken for tests:   8.188731 Seconds
//duration of the entire test
Complete requests:      1000
//number of requests completed
Failed requests:& nbsp;       0
//number of failed requests
Write errors:            0

Total transferred:      1361581 bytes
//network traffic in the entire scene
HTML transferred:        1055666 bytes
//HTML content transfer in the entire scene
Requests per second:    122.12 [ #/sec] (mean)
//One of the most concerned indicators, equivalent to the number of transactions per second in LR, followed by the mean in parentheses indicates that this is an average
time of request:        8188.731 [MS] (mean)
//One of the most concerned metrics bis, the equivalent of the average transaction response time in LR, followed by the mean in parentheses to indicate that this is an average
times per REQUEST:&NBSP;&NBSP;&N bsp;    8.189 [MS] (mean, across all concurrent requests)
//Average actual elapsed time per request
Transfer rate: & nbsp;        162.30 [kbytes/sec] received
//the average traffic per second on the network, can help you troubleshoot problems with excessive network traffic causing a prolonged response time

Connection Times (MS)
Min MEAN[+/-SD] Median max
Connect:4 646 1078.7 89 3291
processing:165 992 493.1 938 4712
waiting:118 934 480.6 882 4554
total:813 1638 1338.9 1093 7785
The decomposition of the time consumed on the network, the specific algorithm of each data is not very clear

Percentage of the requests served within a certain time (MS)
50% 1093
66% 1247
75% 1373
80% 1493
90% 4061
95% 4398
98% 5608
99% 7368
100% 7785 (Longest request)
The response of all requests in the entire scenario. Each request has a response time in the scenario where 50% of the user response time is less than 1093 milliseconds, 60% of the user response time is less than 1247 milliseconds, and the maximum response time is less than 7785 milliseconds

Because the CPU is not actually processed at the same time for concurrent requests, it is rotated on a per-request basis, so it is basically the first time to request times equal to the second time of the request times multiplied by the number of concurrent requests.

3, Siege

1), Introduction
An open source pressure testing tool, can be configured to a Web site multiuser concurrent access, record each user all requests
The corresponding time of the process and is repeated under a certain number of concurrent accesses.

2), Access

http://www.joedog.org/

3), installation
[Root@localhost software]# tar-zxvf siege-2.69.tar.gz #解压
[Root@localhost software]# CD siege-2.69
[Root@localhost siege-2.69]#./configure–prefix=/usr/local/siege #配置安装目录
[Root@localhost siege-2.69]# make && make install #编译安装

Note: The installation will prompt for errors,
MAKE[3]: Entering directory '/usr/local/software/siege-2.69/doc '
/usr/bin/install:cannot Create regular file '/usr/local/siege/etc/siegerc ': No such file or
Directory
MAKE[3]: * * * [Install-exec-hook] Error 1
MAKE[3]: Leaving directory '/usr/local/software/siege-2.69/doc '
MAKE[2]: * * * [Install-exec-am] Error 2
MAKE[2]: Leaving directory '/usr/local/software/siege-2.69/doc '
MAKE[1]: * * * [Install-am] Error 2
MAKE[1]: Leaving directory '/usr/local/software/siege-2.69/doc '
Make: * * * [install-recursive] Error 1
The solution is: mkdir-p/usr/local/siege/etc/siegerc to build such a directory can continue to install down.

4), use

Command format: siege-c Concurrent Quantity-R repetition-F urllist file
Urllist format:

Http://www.taoav.com

Http://www.tuhaoduo.com

Http://www.tiaonv.com

Results show:
Lifting the server siege ... done.
transactions:3419263 hits//complete 419,263 times processing
availability:100.00%//100.00% success rate
Elapsed time:5999.69 secs//Total
Data transferred:84273.91 MB//Total data transfer 84273.91 MB
Response time:0.37 secs//corresponding spents 1.65 seconds: Show Network connection speed
Transaction rate:569.91 trans/sec//All 569.91 processing per second: indicates server
throughput:14.05 mb/sec//Average transmit data per second
concurrency:213.42//Actual maximum concurrent number
Successful transactions:2564081//number of successful processing
Failed transactions:11//failure processing times
Longest transaction:29.04//the maximum time spent per transmission
Shortest transaction:0.00//minimum time spent per transmission

This article from Csdn Blog, reproduced please indicate the source: http://blog.csdn.net/lyflower/archive/2010/09/09/5873544.aspx

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.