How can configure a simulation in Java so it slowly ramps requests to the peak and then holds on the peak for X hours?
Our API service has an Autoscaling policy, so it needs a slow ramp-up with requests to allow it to scale in QA environment.
Currently, I used 2 types of simulations (rampUsers or stressPeakUsers). I am trying to get a combination of both, How can I do that?
setUp(
productServiceScn.createProduct.injectOpen(rampUsers(81900).during(7200)).protocols(http.product)
);
OR
setUp(
productServiceScn.createProduct.injectOpen(stressPeakUsers(81900).during(7200)).protocols(http.product)
);
Base on your need, I would recommend you to use Closed workload model (User controlling), with sample code example (I will assume you don't need to throttle)
My code below is in Scala, you have to convert it to Java yourself
.inject(
rampConcurrentUsers(1).to(YourDesireUser).during(UserRampup),
constantConcurrentUsers(YourDesireUser).during(SteadyLength),
rampConcurrentUsers(YourDesireUser).to(0).during(UserRampdown)
)
In this block, you will ramp your Concurrent Users, recommend to match YourDesireUser with UserRampup, to have the inject rate at 1 User / second. Note that each User initiated will send requests immediately
Then constantConcurrentUsers will hold them there, at your desired SteadyLength.
Lastly you ramp down, recommend to reach the rate at 1 User / second, for gracefully stopping the user.