我正在使用 maven 运行我的 Gatling (Scala) 性能测试。
当我将用户从 100 增加到 150 时,它给了我请求超时问题。
如果我将用户数设置为 300,则会在模拟日志中出现以下错误。
// Gatling scenario injection
val scn = scenario("UATEnvironmentTest")
.exec(http("AdminLoginRequest")
.post("/authorization_microservice/oauth/token")
.headers(headers_1).body(RawFileBody("Login.txt"))
.check(jsonPath("$.access_token")
.saveAs("auth_token")))
.pause(2)
setUp(scn.inject(nothingFor(5 seconds),atOnceUsers(50),rampUsers(250) over(10 seconds))).protocols(httpProtocol)
Error :- j.u.c.TimeoutException: Read timeout to /IP:80 after 120000 ms GROUP Failed to build request Request_1: No attribute named 'auth_token' is defined
以下是配置:
//Maven configuration-pom.xml
java.version 1.8
gatling.version 2.2.3
gatling-plugin.version 2.2.1
scala-maven-plugin.version 3.2.2
// Gatling.conf file
connectTimeout 120000
handshakeTimeout 120000
pooledConnectionIdleTimeout 120000
readTimeout 120000
requestTimeout 120000
最佳答案
对于您的特定情况,错误是@user666 在评论部分已经提到的错误,但是如果您想增加 Gatling 脚本的请求时间,以便保持连接:
关于scala - 在 Gatling 中请求超时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47730392/