问题描述
csv文件约为47MB,如果我不使用batch
,则将花费大量时间来加载文件,并且QPS可以达到8000+。
do not use batch
但是,如果我使用batch(10000)
甚至更多batch(100000)
,则QPS会非常低,大约为800+。 (该文件有100000条记录)
use batch(100000)
脚本如下:
import io.gatling.core.Predef._
import io.gatling.core.Feeder.BatchableFeederBuilder
import io.gatling.core.structure.ScenarioBuilder
import io.gatling.http.Predef._
import io.gatling.http.protocol.HttpProtocolBuilder
import scala.concurrent.duration._
class SuggestDot extends Simulation {
val protoal: HttpProtocolBuilder = http.warmUp("https://www.baidu.com")
.baseUrl("http://192.168.106.142:8080")
.connectionHeader("keep-alive")
.check(jsonPath("$.ret").ofType[Int] is 0)
.check(jsonPath("$.data.data[0]") exists)
val files: BatchableFeederBuilder[String]#F = csv("suggestDot.csv").batch(100000).circular
val test: ScenarioBuilder = scenario("lalamap.myhll.cn").forever(
Feed(files).exec(
http("suggest/doc")
.get("${url}&isNewVersion=true")
)
)
setUp(
test.inject(atOnceUsers(100)).protocols(protoal)
).maxDuration(60 seconds)
}
解决方法
此问题将在即将发布的Gatling 3.4.0中修复,请参见https://github.com/gatling/gatling/issues/3943和https://github.com/gatling/gatling/issues/3944。
顺便说一句,我从您的屏幕截图中可以看出您是加特林分叉的。请考虑成为一名优秀的开源公民并向上游贡献力量。