【问题标题】:Scala Gatling keep inserting user until end of feed file is reachedScala Gatling 一直插入用户,直到到达提要文件的末尾
【发布时间】:2016-11-29 19:10:40
【问题描述】:

我正在尝试以这样一种方式将用户注入到一个场景中,它会一直插入用户,直到使用提要文件的每个条目,因为提要文件包含登录信息。我希望提要文件中的所有用户都登录。目前我能想到的只有两种可能的方法。

  1. 这里我一次在 feedfile 中插入行数。

    scenario("Verified_Login")
      .exec(LoginScenario.scn)
      .inject(atOnceUsers(number_of_entries_in_feedfile))
    
  2. 这里我插入了一个非常长的持续时间,例如 100 秒,然后让 feedfile 循环播放。

    scenario("Verified_Login")
      .exec(LoginScenario.scn)
      .inject(atOnceUsers(1),constantUsersPerSec(1) during(100 seconds)
    

第一种方法的问题是我必须找到提要文件中的条目数,这可能很乏味,因为那里可能有数千个。第二个问题是条目可能并且可能会重复。那么有没有办法一直注入用户,直到提要文件中的条目用完?

【问题讨论】:

    标签: scala gatling


    【解决方案1】:

    根据this 消息来源,从去年开始,Stéphane Landelle - 他是 gatling 的领先者contributor,他说您必须提供足够的数据才能使用这种方法完成模拟。

    我从 Stéphane 链接的帖子确实建议简单地读取文件的长度并使用它来驱动用户数量,正如您在问题中已经提到的那样。

    我建议你阅读这篇文章,因为它会为你提供另一种方法来实现你想要的。除非事情发生变化,否则似乎会尽可能接近。

    这是他们的代码。

      val systemsIdentifier = jdbcFeeder(databaseUrl, databaseUser, databasePassword, sql_systemsIdentifier)
    
      val count = new AtomicInteger(systemsIdentifier.records.size).asLongAs(_ => count.getAndIncrement < systemsIdentifier.records.size)
    
      val comScn = scenario("My scenario")
       .repeat(systemsIdentifier.records.size / count) {
         feed(systemsIdentifier)
         .exec(performActionsChain)
       }
    
      setUp(comScn.inject(rampUsers(count) over (60 seconds))).protocols(httpConf)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-11-09
      • 1970-01-01
      • 1970-01-01
      • 2022-08-03
      • 1970-01-01
      相关资源
      最近更新 更多