zoukankan      html  css  js  c++  java
  • 压力测试工具segie的使用

    压力测试工具segie的使用

    使用文档参考地址:https://www.joedog.org/siege-manual/

    siege4地址:http://download.joedog.org/siege/

    下载程序安装包:http://download.joedog.org/siege/siege-4.0.2.tar.gz

    #解压缩.tar.gz程序包
    tar zxvf siege-4.0.2.tar.gz

    #进入主文件目录
    cd siege-4.0.2

    #删除上次产生的obj及可执行文件,如重复安装,可执行该命令
    make clean

    #校验配置和环境信息
    ./configure --prefix=/opt/siege4

    #编译和安装
    make && make install
    siege命令参数

    SIEGE 4.0.2
    Usage: siege [options]
    siege [options] URL
    siege -g URL
    Options:
    -V, --version VERSION, prints the version number.
    -h, --help HELP, prints this section.
    -C, --config CONFIGURATION, show the current config.
    -v, --verbose VERBOSE, prints notification to screen.
    -q, --quiet QUIET turns verbose off and suppresses output.
    -g, --get GET, pull down HTTP headers and display the
    transaction. Great for application debugging.
    -c, --concurrent=NUM CONCURRENT users, default is 10
    -r, --reps=NUM REPS, number of times to run the test.
    -t, --time=NUMm TIMED testing where "m" is modifier S, M, or H
    ex: --time=1H, one hour test.
    -d, --delay=NUM Time DELAY, random delay before each requst
    -b, --benchmark BENCHMARK: no delays between requests.
    -i, --internet INTERNET user simulation, hits URLs randomly.
    -f, --file=FILE FILE, select a specific URLS FILE.
    -R, --rc=FILE RC, specify an siegerc file
    -l, --log[=FILE] LOG to FILE. If FILE is not specified, the
    default is used: PREFIX/var/siege.log
    -m, --mark="text" MARK, mark the log file with a string.
    between .001 and NUM. (NOT COUNTED IN STATS)
    -H, --header="text" Add a header to request (can be many)
    -A, --user-agent="text" Sets User-Agent in request
    -T, --content-type="text" Sets Content-Type in request

    参数项使用说明
    -c 100 指定并发数 100
    -r 10 指定测试次数 10
    -f urls.txt 指定url文件
    -i internet系统,随机发送url
    -b 请求无需等待 -d NUM 延迟多少秒
    -t 5 持续测试5分钟 -t3600S, -t60M, -t1H
    -v 输出详细信息
    -l 记录压测日志信息到指定文件
    # -r和-t一般不同时使用

    例如:
    cd /opt/siege4/bin
    ./siege -c 10 -r 10 -b -t 10 www.xxx.com

    指定http请求头 文档类型
    ./siege -H "Content-Type:application/json" -v -c 10 -r 10 -f urls.txt -i -d 1 -t20s

    读入文件方式:
    post中的参数可以放到一个文件,再通过以上方式来使用
    ./siege -c 2 -r 2 -b -t 10 www.xxx.com post <./purlx.txt

    在文件中,可以定义变量。类似shell的方式,使用${}或$()。
    host=www.xxx.com http://${host}/index.html

    文件urls.txt中的地址:
    http://www.xxx.com/index.html
    http://www.xxx.com/xxx.jsp
    http://www.xxx.com/xxx.do?key=value
    http://www.xxx.com/xxx.do post key=value
    http://www.xxx.com/xxxx.do post key1=value&key2=value2

    结果说明:
    Transactions: 总共测试次数
    Availability: 成功次数百分比
    Elapsed time: 总共耗时多少秒
    Data transferred: 总共数据传输
    Response time: 等到响应耗时
    Transaction rate: 平均每秒处理请求数
    Throughput: 吞吐率
    Concurrency: 最高并发
    Successful transactions: 成功的请求数
    Failed transactions: 失败的请求数


    1,发送post请求时,url格式为:http://www.xxx.com/ post p1=v1&p2=v2
    2,如果url中含有中文和空格,需先进行encode编码。

  • 相关阅读:
    鼠标拖动DIV移动
    JS中事件&对象
    响应式与弹性布局
    JS中的变量和输入输出
    JS中的运算符&JS中的分支结构
    HTML基本标签
    CSS基础语法
    JS中循环结构&函数
    String 二
    StringBuffer
  • 原文地址:https://www.cnblogs.com/NiceTime/p/6847956.html
Copyright © 2011-2022 走看看