zoukankan      html  css  js  c++  java
  • FW 常见的性能测试工具有: loadRunner/netperf/httperf/apache_ab/Apache JMeter

    常见的性能测试工具有: loadRunner/netperf/httperf/apache_ab/Apache JMeter ,  

    其中loadRunner属于付费软件,所以在这里不做介绍

    netperf(HP公司维护的开源项目)

    主要用来测量大数据量传输的时性能, 这也称作流或者单向流性能。

    主要用来度量一个系统接收或者发送的数据有多快, 最简单的命令如下:

    /opt/netperf/netperf -H remotehost 

    此外, tcp_stream_script和tcp_range_script(位于doc/examples目录下)两个脚本设置相关变量并调用

    netperf对性能进行测试。

    netperf另一个重要功能是对Request/response进行测试. request/response性能也被称作每秒事务数(transactions/s)。

    默认命令如下:

    /opt/netperf/netperf -H remotehost -t TCP_RR 

    有一个调用netperf对 request/response性能进行测试脚本是 tcp_rr_script, 

    httperf(HP公司维护的开源项目)

    --server=S

      Specifies the IP hostname of the server. By default, the hostname ‘‘localhost’’ is used.

    --port=N

      This option specifies the port number N on which the web server is listening for HTTP requests.

    By default, httperf uses port number 80

    --uri=S

    Specifies that URI S should be accessed on the server.

    -v

    --verbose

      Puts httperf into verbose mode.

    --hog 

      This option requests to use up as many TCP ports as necessary. Without this option, httperf is

    typically limited to using ephemeral ports (in the range from 1024 to 5000).

    --max-connections=N

      Specifies that at most N connections are opened for each session. This option is meaningful in

    conjunction with options --wsess and --wsesslog only.

    --num-calls=N

      This option is meaningful for request?oriented workloads only. It specifies the total number of

    calls to issue on each connection before closing it. If N is greater than 1, the server must support

    persistent connections.

    --num-conns=N

      This option is meaningful for request?oriented workloads only. It specifies the total number of

    connections to create. On each connection, calls are issued as specified by options --num-calls

    and --burst-length.

    --period=[D]T1[,T2]

      Specifies the time interval between the creation of connections or sessions. Connections are created

    by default, sessions if option --wsess or --wsesslog has been specified. This connection/

    session ‘‘interarrival time’’ can alternatively be specified by the ??rate option, although more

    flexibility is available with ??period.

    --rate=X

      Specifies the fixed rate at which connections or sessions are created. Connections are created by

    default, sessions if option --wsess or --wsesslog has been specified. In both cases a rate of 0

    results in connections or sessions being generated sequentially (a new session/connection is initiated

    as soon as the previous one completes). The default value for this option is 0.

    --session-cookie

      When this option is turned on, cookie managment is enabled on a per?session basis.

    --think-timeout=X

      Specifies the maximum time that the server may need to initiate sending the reply for a given request.

    --timeout=X

      Specifies the amount of time X that httperf is willing to wait for a server reaction. The timeout is

    specified in seconds and can be a fractional number (e.g., --timeout 3.5).

    --close-with-reset

      Requests that httperf closes TCP connections by sending a RESET instead of going through the

    normal TCP connection shutdown handshake. Turning on this option can have ill effects such as

    data corruption, stuck TCP control blocks, or wrong results. For this reason, the option should not

    be used unless absolutely necessary and even then it should not be used unless its implications are

    fully understood.

    --client=I/N

      Specifies that the machine httperf is running on is client I out of a total of N clients. I should be

    in the range from 0 to R N ?1. Some of the workload generators (e.g., ??wset) use the client

    identity as a bias value to ensure that not all clients generate perfectly identical workloads

    httperf是一款测量web服务器性能的工具, 它可以采用HTTP/1.0或HTTP/1.1协议, 并能产生各种工作负载。

    当运行时, 它记录一些性能指标并在测试运行的终端上将以统计数据的形式打印出来。

    httperf最基本的操作是产生固定数目的HTTP GET请求并记录收到多少从服务器返回的应答。

    为了获得正确的测试结果, 每台客户机最多只运行一个httperf进程, 

    并且在客户端和服务器端上最好不要运行后台进程。

    EXAMPLES

    httperf --hog --server www

        This command causes httperf to create a connection to host www, send a request for the root document

    (http://www/), receive the reply, close the connection, and then print some performance statistics.

    httperf --hog --server www --num-conn 100 --ra 10 --timeout 5

        Like above, except that a total of 100 connections are created and that connections are created at a

    fixed rate of 10 per second. Note that option ‘‘--rate’’ has been abbreviated to ‘‘--ra’’.

    httperf --hog --erver=www --wsess=10,5,2 --rate 1 --timeout 5

    Causes httperf to generate a total of 10 sessions at a rate of 1 session per second. Each session

    consists of 5 calls that are spaced out by 2 seconds.

    httperf --hog --server=www --wsess=10,5,2 --rate=1 --timeout=5 --ssl

    Like above, except that httperf contacts server www via SSL at port 443 (the default port for SSL

    connections).

    apache_ab(Apache Beach)

    格式: ./ab [options] [http://]hostname[:port]/path 

    参数很多,一般我们用 -c 和 -n 参数就可以了. 例如: 

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

    这个表示同时处理100个请求并运行1000次index.php文件. 

    参数: 

    -n requests Number of requests to perform 

    //在测试会话中所执行的请求个数。默认时,仅执行一个请求 

    -c concurrency Number of multiple requests to make 

    //一次产生的请求个数。默认是一次一个。 

    -t timelimit Seconds to max. wait for responses 

    //测试所进行的最大秒数。其内部隐含值是-n 50000。它可以使对服务器的测试限制在一个固定的总时间以内。默认时,没有时间限制。 

    -p postfile File containing data to POST 

    //包含了需要POST的数据的文件. 

    -T content-type Content-type header for POSTing 

    //POST数据所使用的Content-type头信息。 

    -v verbosity How much troubleshooting info to print 

    //设置显示信息的详细程度 - 4或更大值会显示头信息, 3或更大值可以显示响应代码(404, 200等), 2或更大值可以显示警告和其他信息。 -V 显示版本号并退出。 

    -w Print out results in HTML tables 

    //以HTML表的格式输出结果。默认时,它是白色背景的两列宽度的一张表。 

    -i Use HEAD instead of GET 

    // 执行HEAD请求,而不是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 对请求附加一个Cookie:行。 其典型形式是name=value的一个参数对。此参数可以重复。 

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

    //-P proxy-auth-username:password 对一个中转代理提供BASIC认证信任。用户名和密码由一个:隔开,并以base64编码形式发送。

    // 无论服务器是否需要(即, 是否发送了401认证需求代码),此字符串都会被发送。 

    -X proxy:port Proxyserver and port number to use 

    -V Print version number and exit 

    -k Use HTTP KeepAlive feature 

    -d Do not show percentiles served table. 

    -S Do not 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 设置 属性的字符串. 缺陷程序中有各种静态声明的固定长度的缓冲区。

    // 另外,对命令行参数、服务器的响应头和其他外部输入的解析也很简单,这可能会有不良后果。

    // 它没有完整地实现 HTTP/1.x; 仅接受某些'预想'的响应格式。 strstr(3)的频繁使用可能会带来性能问题,即, 你可能是在测试ab而不是服务器的性能。 

    // 参数的中文版

    -A auth-username:password 

    向服务器提供基本认证信息。用户名和密码之间由一个":"隔开,并将被以base64编码形式发送。无论服务器是否需要(即是否发送了401认证需求代码),此字符串都会被发送。 

    -c concurrency 

    一次产生的请求个数。默认是一次一个。 

    -C cookie-name=value 

    对请求附加一个"Cookie:"头行。其典型形式是 name=value 的一个参数对。此参数可以重复。 

    -d 

    不显示"percentage served within XX [ms] table"消息(为以前的版本提供支持)。 

    -e csv-file 

    产生一个逗号分隔(CSV)文件,其中包含了处理每个相应百分比请求(从1%到100%)所需要的相应百分比时间(以微秒为单位)。由于这种格式已经"二进制化",所以比"gnuplot"格式更有用。 

    -g gnuplot-file 

    把所有测试结果写入一个"gnuplot"或者TSV(以Tab分隔)文件。此文件可以方便地导入到 Gnuplot, IDL, Mathematica, Excel中。其中的第一行为标题。 

    -h 

    显示使用方法的帮助信息。 

    -H custom-header 

    对请求附加额外的头信息。此参数的典型形式是一个有效的头信息行,其中包含了以冒号分隔的字段和值(如:"Accept-Encoding: zip/zop;8bit")。 

    -i 

    执行HEAD请求,而不是GET 。 

    -k 

    启用KeepAlive功能,即在一个HTTP会话中执行多个请求。默认不启用KeepAlive功能。 

    -n requests 

    在测试会话中所执行的请求个数。默认仅执行一个请求,此时其结果不具有意义。 

    -p POST-file 

    包含了POST数据的文件。 

    -P proxy-auth-username:password 

    对一个中转代理提供基本认证信息。用户名和密码由一个":"隔开,并将被以base64编码形式发送。无论服务器是否需要(即是否发送了407代理认证需求代码),此字符串都会被发送。 

    -q 

    如果处理的请求数大于150,ab每处理大约10%或者100个请求时,会在stderr输出一个进度计数。此 -q 标记可以屏蔽这些信息。 

    -s 

    用于编译中(ab -h 会告诉你)使用了SSL的受保护的https ,而不是http协议的时候。此功能是实验性的,最好不要用。 

    -S 

    不显示中值和标准偏差值,而且在均值和中值为标准偏差值的1到2倍时,也不显示警告或出错信息。默认时,会显示最小值/均值/最大值等数值。(为以前的版本提供支持) 

    -t timelimit 

    测试所进行的最大秒数。内部隐含值是"-n 50000"。它可以使对服务器的测试限制在一个固定的总时间以内。默认时,没有时间限制。 

    -T content-type 

    POST数据时所使用的"Content-type"头信息。 

    -v verbosity 

    设置显示信息的详细程度,4或更大值会显示头信息,3或更大值可以显示响应代码(404,200等),2或更大值可以显示警告和其他信息。 

    -V 

    显示版本号并退出。 

    -w 

    以HTML表格形式输出结果。默认时,它是白色背景的两列宽度的一张表。 

    -x <table>-attributes 

    设置<table>属性的字符串。此属性被填入<table 这里 > 。 

    -X proxy[:port] 

    对请求使用代理服务器。 

    -y <tr>-attributes 

    设置<tr>属性的字符串。 

    -z <td>-attributes 

    设置<td>属性的字符串。 

    Apache JMeter 

    这是一款很不错的性能测试软件, 它不仅功能强大而且还免费, 操作界面与LoadRunner相似。

    它是一款用来对客户端/服务器软件(如web应用)进行负载测试的、 100%纯Java桌面应用。

    它能来用对静态文件、 Java Servlet、 CGI脚本、Java对象、数据库、ftp服务器等静态和动态资源进行性能测试。

  • 相关阅读:
    Matlab Tricks(二十九) —— 使用 deal 将多个输入赋值给多个输出
    释名 —— 名称的含义、来源
    Eclipse快捷键 今天又学会了几个不常用的 收藏了
    HDU 2527
    UVAlive 2326 Moving Tables(贪心 + 区间问题)
    STM32关于优先级设定的理解 NVIC_SetPriority()
    linux6.2安装mysql
    【PAT】1009. Product of Polynomials (25)
    Android的重力传感器(3轴加速度传感器)简单实例
    out/target/common/obj/PACKAGING/public_api.txt android.view.KeyEvent.KEYCODE_has changed value from
  • 原文地址:https://www.cnblogs.com/SZLLQ2000/p/4580233.html
Copyright © 2011-2022 走看看