我的意图是让2000个虚拟用户同时使用两个不同的网址命中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 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)
}
答案 0 :(得分:0)
My2cents:内容被提供给具有过期日期标题的getter,因此它被缓存。 请参阅caching documentation。
然后,您能否验证前一个问题的答案?