【问题标题】:Gatling-Value baseURL is not a member of io.gatling.http.protocol.HttpProtocolBuilderGatling-Value baseURL 不是 io.gatling.http.protocol.HttpProtocolBuilder 的成员
【发布时间】:2019-08-10 10:39:23
【问题描述】:

我在下面编写了以下加特林场景。我收到以下错误

值 baseURL 不是 io.gatling.http.protocol.HttpProtocolBuilder 的成员

我尝试直接导入 io.gatling.http.protocol.HttpProtocolBuilder 但这并没有解决问题。谁能找出我下面代码中的根本原因?

另外,我希望这个场景能够在 4 小时内针对 2000 个用户增加 100 万个请求。下面的注入是否成功执行了该负载?

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

 class Kafka extends Simulation{
      val httpProtocol = http.baseURL("https://apex-my-url-is.in.these.quotes.com");

      val kafkaScenario = scenario("KafkaPerfTest")
      .exec(http("Kafka Request").post("/method/method")
                            .header("Content-Type", "application/json")
                            .body(StringBody(""" 
                              {
                                "logDatetime": "2019-03-18T20:26:38.940Z",
                                "url": "/test",
                                "apiName": "test",
                                "apiVersion": "test",
                                "method": "GET",
                                "status": 200,
                                "vin": "TESTTESTVIN0001",
                                "accessToken": "test",
                                "user": "test",
                                "queryParams": "",
                                "requestHeader": "test",
                                "requestBody": "test",
                                "responseHeader": "test",
                                "responseBody": "test",
                                "responseTime": 200,
                                "traceId": "test",
                                "serviceName": "test",
                                "type": "INBOUND"
                              } 
                              """))
                              .check(status.is(202)));
  setUp(kafkaScenario.inject(
    constantConcurrentUsers(2000) during(4 hours))
    .protocols(httpProtocol)
    .throttle(jumpToRps(500),holdFor(4 hours)));
  }

【问题讨论】:

    标签: scala simulation gatling


    【解决方案1】:

    尝试“http.baseUrl”而不是“http.baseURL”

    【讨论】:

    • 成功了!我的设置是否正确,可以在 4 小时内针对 2000 个用户增加 100 万个请求?
    • 通过这个设置,你将在 4 小时内注入 2800 万用户,但由于节流,只有部分用户能够执行请求,其余的会卡在队列中,我不记得是否等待用户正在打开连接,但您可能会用完打开的套接字或以这种方式达到连接限制。我建议从较少的用户和较短的测试开始,然后找出最适合您的方法。
    • 感谢 Mateusz。我们希望了解此服务如何处理大量请求。我们并不真正关心用户的数量。这就是我使用“throtte”的原因。你会推荐 constantUsersPerSec 吗?
    • 看起来 baseURL 在 gatling 库中被重命名为 baseUrl(可能是 v3)。因此,有效的情况将取决于您使用的 gatling 版本。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-05-01
    • 1970-01-01
    相关资源
    最近更新 更多