Performance 使用Gatling发送的请求数不相等
我的意图是让2000个虚拟用户同时点击一个带有两个不同url的API,结果是第一个url完成了所有请求,第二个url只完成了168个。我做错了什么导致第二个url只发布部分结果Performance 使用Gatling发送的请求数不相等,performance,gatling,Performance,Gatling,我的意图是让2000个虚拟用户同时点击一个带有两个不同url的API,结果是第一个url完成了所有请求,第二个url只完成了168个。我做错了什么导致第二个url只发布部分结果 class hammer1 extends Simulation { val repeatCount = 2000 val concurrentUsers = 100 object Post { // repeat is a loop resolved at RUNTIME val
class hammer1 extends Simulation {
val repeatCount = 2000
val concurrentUsers = 100
object Post {
// repeat is a loop resolved at RUNTIME
val post = repeat(repeatCount, "i") { // Note how we force the counter name so we can reuse it
exec(http("Post")
.post("/postData")
.header(HttpHeaderNames.ContentType, HttpHeaderValues.ApplicationJson)
.queryParam("""size""", "1000")
.body(StringBody("""{"payload":"Large number of 9s"}""")
)
.pause(1)
}
}
object Get {
// repeat is a loop resolved at RUNTIME
val get = repeat(repeatCount, "i") { // Note how we force the counter name so we can reuse it
exec(http("Get")
.get("/getData")
)
. pause(1)
}
}
val httpConf = http
//.baseURL("http://<url>")
//.baseURL("http://localhost:10010")
. baseURL("http://<url>")
val posters = scenario("Posters").exec(Post.post)
val getters = scenario("Getters").exec(Get.get)
setUp(posters.inject(rampUsers(concurrentUsers) over (10 seconds)),
getters.inject(rampUsers(concurrentUsers) over (10 seconds))
).protocols(httpConf)
}
class hammer1扩展了模拟{
val repeatCount=2000
val concurrentUsers=100
物件柱{
//repeat是在运行时解析的循环
val post=repeat(repeatCount,“i”){//注意我们是如何强制计数器名称的,以便可以重用它的
执行官(http(“Post”)
.post(“/postData”)
.header(HttpHeaderNames.ContentType、HttpHeaderValues.ApplicationJson)
.queryParam(“大小”、“1000”)
.body(StringBody(“{”有效负载“:“大量9”}”)
)
.暂停(1)
}
}
对象获取{
//repeat是在运行时解析的循环
val get=repeat(repeatCount,“i”){//注意我们是如何强制计数器名称的,以便可以重用它的
exec(http(“Get”)
.get(“/getData”)
)
.暂停(1)
}
}
val httpConf=http
//.baseURL(“http://”)
//.baseURL(“http://localhost:10010")
.baseURL(“http://”)
val海报=场景(“海报”).exec(Post.Post)
val getters=scenario(“getters”).exec(Get.Get)
设置(海报注入(rampUsers(concurrentUsers)超过(10秒)),
注入(rampUsers(concurrentUsers)超过(10秒))
).协议(httpConf)
}
My2cents:内容被提供给带有过期日期头的getter,因此它被缓存。
看
那么,你能验证一下你之前问题的答案吗