constructing a very large json load to be used in subsequent request

I have one http get that returns this json as response:

`

{“modeltabSearchData”:[{“MATNR”:“000000000000707070”,“WERKS”:“1003”,“LGORT”:“0001”,“POS”:"",“LABST_SUM”
:0.000 },{“MATNR”:“000000000000707070”,“WERKS”:“1003”,“LGORT”:“0001”,“POS”:"",“LABST_SUM”:0.000 },{“MATNR”
:“000000000000707070”,“WERKS”:“1003”,“LGORT”:“0001”,“POS”:"",“LABST_SUM”:0.000 }]}

`

I want to loop this request about 50.000 times (!) with a loop.

then being able to save every 50.000 json body being returned (somewhere) and then reuse the 50.000 jsonbodies in the subsequent request like this (for only 2 instances not 50.000):

.exec(http(“request_0”)
.post("/xxx")
.headers(headers_0)
.formParam("""{}||[{“MATNR”:“000000000000707070”,“WERKS”:“1003”,“LGORT”:“0001”,“POS”:"",“LABST_SUM”:0},{“MATNR”:“000000000000707070”,“WERKS”:“1003”,“LGORT”:“0001”,“POS”:"",“LABST_SUM”:0},{“MATNR”:“000000000000707070”,“WERKS”:“1003”,“LGORT”:“0001”,“POS”:"",“LABST_SUM”:0},{“MATNR”:“000000000000707070”,“WERKS”:“1003”,“LGORT”:“0001”,“POS”:"",“LABST_SUM”:0}]""", “”))

a very large “formParam” in other words. could Gatling even hold a 50.000 object json in runtime as i.e. a vector?

Any idea how to do this?

Thanks!

I guess I can save all the json responsen like this:

.check(jsonPath("$").saveAs(“ALL”)))

.exec(session => {
println((session(“ALL”).as[String]))
session})

I can see that being printed to console, but I need to construct a very large vector (?) or similar to be used in the subsequent request.
Earlier I have picked out values from json responses and put them into a vector using .exec(_.set(“itemList”, Seq.empty[Int]))

Than I would have to separate all the json responses with i.e. comma. how could I implement such logic and how would I reference the large json in the subsequent request?

Ii this even possible given the nature of this should build up to 50.000 instances of the one like this:

`

{“modeltabSearchData”:[{“LABST_SUM”:0.0,“LGORT”:"",“MATNR”:"",“POS”:"",“WERKS”:""},{“LABST_SUM”:0.0,“LGORT”:“0001”,“MATNR”:“000000000000707070”,“POS”:"",“WERKS”:“1003”}]}

`

?

Cheers

It should be doable, provided you don’t run out of memory. And you can (almost) always increase memory.

You’ll need to do some Scala work to make it happen. And if you do it in multiple users, then you will need to use a thread-safe data structure. Google “scala list append” and learn from what others have struggled with. :slight_smile: