使用siege进行web压力测试

it2022-05-08  10

  因为最近公司线上node项目出一些不稳定的情况,考虑在这方面能不能做进一步的优化,既然要做优化首先要知道问题出在哪里?

因为暂无法定位是node层问题还是api层出现问题,由于在开发环境小并发量程序运行都是很稳定的,后面考虑使用一些压力工具去验证在高并发的时候线上的问题,这里我首选siege来做压力测试。

一:安装

  我这里使用的系统是FreeBSD,包请自行下载:http://download.joedog.org/siege/siege-latest.tar.gz

  tar zxvf siege-latest.tar.gz cd siege-3.0.9 ./configure make & make install

     很快就安装完毕了

 查看一下配置文件

/usr/local/siege/bin/siege -c

CURRENT SIEGE CONFIGURATIONMozilla/5.0 (unknown-x86_64-freebsd10.0) Siege/3.0.9Edit the resource file to change the settings.----------------------------------------------version: 3.0.9verbose: truequiet: falsedebug: falseprotocol: HTTP/1.1get method: HEADconnection: closeconcurrent users: 15time to run: n/arepetitions: 100socket timeout: 30accept-encoding: gzipdelay: 1 secinternet simulation: falsebenchmark mode: falsefailures until abort: 1024named URL: http://matouapp.ymatou.com/forymatouapp/homeURLs file: /etc/urls.txtlogging: truelog file: /var/siege.logresource file: /root/.siegerctimestamped output: falsecomma separated output: falseallow redirects: trueallow zero byte data: trueallow chunked encoding: trueupload unique files: true

二、使用  

  参数介绍:   transactions:处理的请求数   Availability: 成功率   Elapsed Time:需要多少时间   Data transferred :传输了多少字节 Response time: 响应时间 Transaction rate:平均每秒完成多少次处理 (表示后台的处理速度)   Throughput:平均每秒传输速度   Concurrency:最高并发量   Successful transactions :成功的处理数   Failed transactions:失败的处理数     Longest transactions:传输最长的时间  Shortest transactions:传输最短的时间

 

  50个用户(每次并发量,不是每秒并发量)重复10 共产生 50 *10= 500个请求 (默认:GET)

  /usr/local/siege/bin/siege -c 50 -r 10 http://matouapp.ymatou.com/forymatouapp/home

  执行结果:

       

 

转载于:https://www.cnblogs.com/river-lee/p/4390789.html

相关资源:siege压力测试windows版

最新回复(0)