Gatling rampUser and active user - scala

I use rampUsers(20)over (120) in my gatling load test. But I got the following result
I expected the active user should be constant during the test.

rampUsers injects the defined numbers of users linearly over a given time. So your use of rampUsers(20)over (120) will result in gatling starting one user every 6 seconds. The graph you're getting shows this, but what might be confusing is that since your scenario completes in less than 6 seconds there's never more than one user active at a time.
if you're aiming for 20 concurrent users over 120 seconds, there's a different injection profile for that...
constantConcurrentUsers(20) during (120 seconds)

Related

Measuring system time of specific agent in anylogic

I've got 3 different product types of agent, which each go it's individual path within the fabric. How can i measure the average time the product type spends in the system?
My logic looks like this , and i wanted to implement the measurement in the first service, like this:, it will be completed in the last service like this :
Now I get some really high numbers, which are absolutely wrong. The process itself works fine, if you run the measurement with the code "//agent.enteredSystemP1 = time()", you will get a mean of 24 minutes, per product. But how can i get the mean per product type?
Just use the same if-elseif-else distinction in the 2nd service block as well.
Currently, any agent leaving the system adds time to any systemTimeDistribution

How to stop timeout in service block

I am modeling ticket system with various SLA. The model must contain several service blocks with different reaction time ( from 2 to 32 hours). In the service block only working hours should be taken into account. So in the service block timeout should stop when non-workong hours and on the weekend. Could you please kindly tell me how i can realize it?
Thank you very much in advance!
I can think of two answers, one simplified but works in many cases, the other more advanced and probably more accurate:
Simplified approach: I would set the model in hours and keep everything running as is without any stop. So, at the end of the simulation, if the total time is 100 hours and you know that you have 8 hours/day with 5 days/week, then you'd know the total duration is 2.5 weeks. Of course, this might have limitations or might become more complex later on if you want day-specific actions (e.g. you want to differentiate between Monday, Tuesday, etc.)
Advanced more accurate approach: Create resources whose capacities are defined by schedule and assigned them to your services. Create a schedule and specify the working hours in that schedule. Check the below link to learn more about schedules. I call this the more advanced approach because you need to make sure the schedule is defined correctly and make sure all elements in the model are properly controlled (e.g. non-service blocks such as source, delays, etc.).
https://help.anylogic.com/topic/com.anylogic.help/html/data/schedule.html?resultof=%22%73%63%68%65%64%75%6c%65%73%22%20%22%73%63%68%65%64%75%6c%22%20
I personally would use the first approach if the model is rather simple and modeling working hours is enough for analysis. Otherwise, I'd go for option 2.
Finally, another option I'd like to highlight is the "suspend/resume" functions. I am only adding this because you asked "how to stop timeout". So these functions specifically stop and resume timeout. But you'll need to define the times at which they are executed (through an event for example).

How do I set random break times for each resource?

I would like to set a random break time of 2 hours everyday for each resource unit within a resource pool. I was able to add a schedule for break times set to 2 hours from 12 pm - 2 pm, however, I would like that time interval to be randomly selected for each resource everyday. Can anyone help me with this? I'm pretty new to AnyLogic.
Thanks!
AT
instead of using the break setting forcing you to define a schedule (which is not random), use the "failures/repairs" setting instead and apply randomness as below. Note that this may cause more than 1 break in a day, but on average, it will be 1 a day for 2 hrs. Note also that failures behave exactly like breaks functionally.
You can, of course, also apply your own custom ResourceTask, name it "breaks" and set it up there.
I will give you a solution that will ensure that your resources take 1 break per day:
Create a variable in your resource agent called timeForNextBreak with initial value uniform(0,22) ... since they take 2 hours break, you want this to happen between 00:00 and 22:00, this also assumes your simulation starts at 00:00
Creat a variable in your resource agent called timeRemainingInDay with initial value 24, this also assumes your simulation starts at 00:00
create a custom resource task called randomBreak and use it in your resource pool
In your randomBreak resource task, complete the data as follows.

MongoDB : Alert when count of records is high

I am new to MongoDB and have a table like below
boxname
time_create
box_data
Basically what we are logging here is which box is sending what data and at what time.
Now my requirement is that is to create an alert in system if a box sends more request than a threshold values indicating probably something is wrong or suspicious from that box. I can get the count of records for a box for a time period say 10 mins - but this query is different - each 10 mins check counts for all boxes and check if any exceed more than threshold.
Do I need to do regular polling after 10 mins? Do a program needs to run infinitely to count # and alert - what would be best method to implement the same?
What would be the best mechanism of implementation for such a requirement?
To solve this problem - query scheduler is needed.
That means - every x minutes we need to execute query and check if any box have been matched with threshold criteria.
Scheduler implementation is most based on your current solution architecture (as I am in c# - HangFire will be my selection to implement scheduler).

Gatling test that uses a different action every request

We're trying to stress test our REST-ish app with Gatling. We want our users to make a post with a different fileBody every request.
Our scenario looks like:
scenario("100%")
.during(15 minutes) {
exec(requestStream.next())
.pause(118 seconds, 120 seconds)
}
.users(2)
.delay(2 minutes)
.protocolConfig(httpConf)
...build up several scenarios...
setUp(severalScenarios)
This runs fine but it appears that the block with the exec is only executed one time when each scenario is built for the first time. We thought that the block would be executed every time the during(...) loop comes around giving each user a new Request from the iterator to run every 15 minutes.
Are we missing something? Is there a smarter way of doing this?
No, that's not the way the DSL works. The DSL elements are actually builders that are resolved once and for all when the simulation is loaded.
What you want is inject dynamic data into your scenario elements, and you have to use Feeders, user Session, Gatling EL, etc. What does your requestStream look like?