Gatling连续负载测试工具

官网地址:https://gatling.io/

Gatling专为进行连续负载测试而设计,并与您的开发管道集成在一起。加特林(Gatling)包括网络记录仪和彩色报告。号称最佳测试Web应用程序的开发人员工具。

Gatling FrontLine是Gatling的管理界面,其中包括用于集成和自动化的高级指标和高级功能。

使用

首先,到官网下载最新版的gatling:

https://repo1.maven.org/maven2/io/gatling/highcharts/gatling-charts-highcharts-bundle/2.3.1/gatling-charts-highcharts-bundle-2.3.1-bundle.zip

然后解压缩到本地路径:

unzip gatling-charts-highcharts-bundle-2.3.1.zip

mv gatling-charts-highcharts-bundle-2.3.1 gatling

然后看一下打压脚本:

import io.gatling.core.Predef._ 
import io.gatling.http.Predef._
import scala.concurrent.duration._

class HelloSimulation extends Simulation {

  val httpConf = http 
    .baseURL("http://192.168.99.100:30888") 

  val scn = scenario("HelloSimulation").during(30) {
    exec(http("hello_1")
    .get("/lmsia-abc/api/"))
  }

  setUp(
    scn.inject(atOnceUsers(2000))
  ).protocols(httpConf)
}

如上,Gating的打压脚本稍微复杂一些:

  • 服务根地址192.168.99.100:30888
  • 访问的get请求"/lmsia-abc/api/"
  • 并发2000个用户

执行一下打压:

gatling.sh -sf . -s HelloSimulation

结果中可以直接看到各项统计结果:

---- Global Information --------------------------------------------------------
> request count                                     353505 (OK=353505 KO=0     )
> min response time                                      0 (OK=0      KO=-     )
> max response time                                   1644 (OK=1644   KO=-     )
> mean response time                                   170 (OK=170    KO=-     )
> std deviation                                        122 (OK=122    KO=-     )
> response time 50th percentile                        143 (OK=143    KO=-     )
> response time 75th percentile                        219 (OK=219    KO=-     )
> response time 95th percentile                        408 (OK=408    KO=-     )
> response time 99th percentile                        606 (OK=606    KO=-     )
> mean requests/sec                                11047.031 (OK=11047.031 KO=-     )
---- Response Time Distribution ------------------------------------------------
> t < 800 ms                                        353348 (100%)
> 800 ms < t < 1200 ms                                 148 (  0%)
> t > 1200 ms                                            9 (  0%)
> failed                                                 0 (  0%)
================================================================================

Reports generated in 2s.
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值