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

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


: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):

.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?


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


.exec(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:






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: