51Testing软件测试论坛

 找回密码
 (注-册)加入51Testing

QQ登录

只需一步,快速开始

微信登录,快人一步

手机号码,快捷登录

查看: 3016|回复: 3
打印 上一主题 下一主题

[转贴] 压力测试工具segie的使用

[复制链接]

该用户从未签到

跳转到指定楼层
1#
发表于 2017-6-20 10:59:28 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 草帽路飞UU 于 2017-6-20 11:15 编辑

压力测试工具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
指定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 post <./purlx.txt
在文件中,可以定义变量。类似shell的方式,使用或
()。
host=www.xxx.com http://${host}/index.html
文件urls.txt中的地址:
post key=value
post key1=value&key2=value2
结果说明:
Transactions: 总共测试次数
Availability: 成功次数百分比
Elapsed time: 总共耗时多少秒
Data transferred: 总共数据传输
Response time: 等到响应耗时
Transaction rate: 平均每秒处理请求数
Throughput: 吞吐率
Concurrency: 最高并发
Successful transactions: 成功的请求数
Failed transactions: 失败的请求数

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

分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏1
回复

使用道具 举报

  • TA的每日心情
    无聊
    2024-7-12 13:16
  • 签到天数: 1 天

    连续签到: 1 天

    [LV.1]测试小兵

    2#
    发表于 2017-6-20 11:16:54 | 只看该作者
    什么自动化测试容易上手?
    回复 支持 反对

    使用道具 举报

    该用户从未签到

    3#
     楼主| 发表于 2017-6-20 11:17:46 | 只看该作者
    乐哈哈yoyo 发表于 2017-6-20 11:16
    什么自动化测试容易上手?

    python,现在自动化的话,一般手机端的自动化比较流行。web端自动化比较少用。
    回复 支持 反对

    使用道具 举报

  • TA的每日心情
    奋斗
    1 小时前
  • 签到天数: 2773 天

    连续签到: 4 天

    [LV.Master]测试大本营

    4#
    发表于 2017-6-20 13:10:07 | 只看该作者
    第一次听说
    回复 支持 反对

    使用道具 举报

    本版积分规则

    关闭

    站长推荐上一条 /1 下一条

    小黑屋|手机版|Archiver|51Testing软件测试网 ( 沪ICP备05003035号 关于我们

    GMT+8, 2024-9-21 08:35 , Processed in 0.072114 second(s), 23 queries .

    Powered by Discuz! X3.2

    © 2001-2024 Comsenz Inc.

    快速回复 返回顶部 返回列表