草帽路飞UU 发表于 2017-6-20 10:59:28

压力测试工具segie的使用

本帖最后由 草帽路飞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
       siege 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编码。

乐哈哈yoyo 发表于 2017-6-20 11:16:54

什么自动化测试容易上手?

草帽路飞UU 发表于 2017-6-20 11:17:46

乐哈哈yoyo 发表于 2017-6-20 11:16
什么自动化测试容易上手?

python,现在自动化的话,一般手机端的自动化比较流行。web端自动化比较少用。

jingzizx 发表于 2017-6-20 13:10:07

第一次听说
页: [1]
查看完整版本: 压力测试工具segie的使用