java - Gatling 2.0 throttle 不发送任何请求

标签 java scala performance-testing load-testing gatling

我正在尝试运行具有节流功能的简单 Gatling 场景,但没有请求发送到服务器。

我正在使用 Gatling 2.0.2、Java 1.8.0_25、Maven 3.2.3(都在 OS X 上运行)

我的代码是这样的:

object RequestHomePage {

  def apply() = {
      exec(http("Home Page Request")
        .get("http://my.page/home")
        .header("Accept", "application/xml,application/xhtml+xml")
  }
}

object HomePage {

  val executeScenario = scenario("Home Page Retrieval")
                                  exec(RequestHomePage())
}

class PerformaceSimulation extends Simulation {

  val maxResponseTime = 5000 // milliseconds

  val simultaneousUsers = atOnceUsers(100)

  setUp(HomePage.executeScenario
          .inject(atOnceUsers(100))
          .throttle(jumpToRps(1), holdFor(10 seconds))
    )
    .protocols(httpProtocol)
    .assertions(
      global.responseTime.max.lessThan(maxResponseTime)1
    )
}

输出如下:

    ================================================================================
    2015-02-20 16:39:41                                           4s elapsed
    ---- Home Page Retrieval -------------------------------------------------------
    [##########################################################################]100%
              waiting: 0      / active: 0      / done:100   
    ---- Requests ------------------------------------------------------------------
    > Global                                                   (OK=0      KO=0     )

    ================================================================================
Simulation finished
Parsing log file(s)...
Parsing log file(s) done
java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at scala_maven_executions.MainHelper.runMain(MainHelper.java:164)
    at scala_maven_executions.MainWithArgsInFile.main(MainWithArgsInFile.java:26)
Caused by: java.lang.UnsupportedOperationException: There were no requests sent during the simulation, reports won't be generated

有谁知道为什么 throttle(...) 不发送任何请求? 谢谢

最佳答案

自 2.0.2 以来,已经修复了几个关于节流的错误。请升级到 2.1.4。

关于java - Gatling 2.0 throttle 不发送任何请求,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28634570/

相关文章:

java - 有没有办法配置 ClientBuilder POST 请求,使其能够接收返回码和 JSON 对象?

java - 哪个 JVM Flag 设置了 G1Ergonomics 日志中提到的 GC 开销阈值?

java - 回到主课

scala - 理解 scala 的 _ 与 Any/Nothing

scala - 基于 bool 值填充枚举集

performance-testing - 如何将提取的数据写入加特林文件

java - "Cannot reproduce"- Java 确定性多线程是否可能?

scala - 加特林馈线 - 从列表中获取信息

jmeter - 如何使用制表符分隔符为现有的 JMeter csv/jtl 文件生成仪表板报告

kubernetes - 从Kubernetes中的Pod重新启动其他节点上的Pod