Simple use of Apachebench

Source: Internet
Author: User
Tags response code server port

Simple use of Apachebench 2013-03-08 15:48:47

Category: LINUX

Apachebench Apache A gadget that comes with , dedicated to HTTP Server benchmark testing You can simulate multiple concurrent requests at the same time.
    need to do stress testing on the web, so simply study it and make a note.
   
    The environment used is centos5.5, using the Yum installation Apache,ab tool in the/usr/bin directory:


    1. [[email protected] ~]# cat/etc/redhat-release
    2. centos release 5.5 (Final)
    3. /usr/bin/ab


The basic form of AB:



    1. name
    2. ab-apache HTTP Server Benchmarking tool
    3. synopsis
    4. ab [-A Auth-username: Password] [-B windowsize] [-c concurrency] [-c Cookie-name=value] [-d] [-e Csv-file] [-F Protocol] [-G GNUPL Ot-file] [-h] [-H custom-header] [-i]
    5. [-K "[-N requests] [-p Ost-file] [-P proxy-auth-username:password] [-Q] [-r] [-S] [-S] [-t timelimit] [-t content-type] [-u put-f Ile] [-v verbosity] [-v] [-W] [
    6. -x <table>-attributes] [-x P roxy[:p ort] [-y <tr>-attributes] [-Z <td>-attributes] [-Z ciphersuite] [http[s]://]hostname[:p Ort]/pat H



    a simple test for Baidu and results:

  1. [Email protected] ~]# ab-n 100-c http://www.baidu.com/ ###-n: Number of requests issued-C: concurrency per session
  2. This is apachebench, Version 2.0.40-dev < $Revision: 1.146 $> apache-2.0
  3. Copyright 1996 Adam Twiss, Zeus technology LTD, http://www.zeustech.net/
  4. Copyright 2006 the Apache software Foundation, http://www.apache.org/

  5. Benchmarking www.baidu.com (Be patient) ... done


  6. Server software:bws/1.0 # # # servers Information
  7. Server Hostname:www.baidu.com # # #域名
  8. Server port:80 # # #连-Connected ports
  9. Document Path:/ # #请求的URI
  10. Document length:10530 bytes # # #第一次返回文档的大小. If the size of the document changes during testing, the response is considered an error.

  11. Concurrency level:10 # # #并发数
  12. Time taken for tests:29.32944 seconds # # #开start to end
  13. Complete requests:100 # # #成功的请求数
  14. Failed requests:42 # # #失败的请求数
  15. (connect:0, length:42, exceptions:0) # # #详细的多少个连接失败, length exception, read failed
  16. Write errors:0 # # #在发送的时候失败的次数
  17. Total transferred:1131908 bytes # # #从服务器接收的字节数. This is the explicit network send byte.
  18. HTML transferred:1084140 bytes # # #html内容传输量
  19. Requests per second:3.44 [#/sec] (mean) # #每秒请求数
  20. Time per request:2903.294 [MS] (mean) # # #每个并发的时间
  21. Time per request:290.329 [MS] (mean, across all concurrent requests) # # #个人Understand how long each request is in each concurrency
  22. Transfer rate:38.06 [Kbytes/sec] Received # # # of network traffic per second

  23. Connection Times (MS)
  24. Min MEAN[+/-SD] Median max
  25. Connect:37 1003 809.6 898 4056 ## #The time it takes for the socket to make a request to establish a connection.
  26. total:336 2717 1248.4 2739 6655 # # #conn +processing



### 50% user response time is less than 3064 milliseconds, %< Span style= "color:red;" > milliseconds, the maximum response time is less than 3184 ms

    1. percentage of the requests served Within a certain Time (ms)
    2. 50% 2739
    3. 66% 3017
    4. 80% 3187
    5. 90 % 3998
    6. 95% 5607
    7. 98% 6095
    8. 99% 6655
    9. 100% 6655 (Longest request)


More parameters:

-A Auth-username:password some requests require a username and password for authentication: (For example: 401 authentication requirements).-B windowsize TCP sends and receives a buffer size in bytes-c concurrency concurrency, the number of requests sent at the same time, the default is 1. -C Cookie-name=value plus cookies: in the form of "Name=value", you can repeat the-C xx1=yy1-c xx2=yy2. -D does not show "percentage served within XX [MS] table".-e Csv-file write a comma-delimited CSV file containing the time (in milliseconds) that each percentage (from 1% to 100%) server executes, this file is generally is more useful than ' gunplot '. -F protocol Specifies the SSL/TLS protocol (SSL2, SSL3, TLS1, or All).-G Gnuplot-file Write all useful information to the TSV (Tab separate values) file, which can be easily imported into Excel Wait inside, label on the first line of the file. -H Display Help information-H custom-header Add additional header information. Split with a colon, for example ("Accept-encoding:zip/zop;8bit")-I sends a GET request-K to open the KeepAlive feature of HTTP. Executes multiple requests in an HTTP session. Default does not open. -N Requests the number of request checksums to execute. The default request once, the result of the request does not represent the verification result, is inaccurate. -P Post-file contains the POST data file-P Proxy-auth-username:password supports basic auth proxy route validation. At (required for HTTP code:407)-Q when the program has 150 requests, the output is displayed for every 10% or 100. -Q is used to cancel this information. -R does not exit when the socket is wrong. -S if used in the SSL protocol, the function is still in the experimental phase, you do not need to use it. -S does not display termination and standard values, nor does it display warning messages. The maximum time that the-T TimeLimit Checksum takes, internally set-n 50,000 times. Use this option to test within a specific time period. The-T Content-type is not turned on by default forPost/put data, such as eg. Application/x-www-form-urlencoded. Default:text/plain.-u put-file PUT file, remember to add-t-v verbosity set output level, 4 output header information, 3 output response code (404,200) 2 output warning and information-v display version, and then exit 。 -W output results to table in HTML, default two columns, white background. -X <table>-attributes String to use as attributes for <table>. Attributes is inserted <table here >.-x proxy[:p ORT] use a proxy. -Y <tr>-attributes setting properties to <tr>.-z <td>-attributes setting properties to <td>.-z Ciphersuite specifying SSL/TLS cipher sets (see OpenSSL ciphers).

Simple use of apachebench

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.