Realistic simulations

Let’s assume I have 4 user scenarios:

  1. User enters the website, fills some form, submits it, which leads to adding a row to a database.
  2. User enters the website, deletes the same form, removes row from the database.
  3. User sorts some things on website (makes sort queries to database)
  4. User modifies some things on website (change data in the database)

So I need around 1 000 virtual users. How can I make the scenarios more realistic. I suppose just 1k users spamming DB requests all in the same time is not a good practice. I set up some ramp-up time and pauses, but when I get the results, some requests are over 20k ms, which isn’t good. Maybe some advice?

1.000 virtual users - why that particular number?

The number of virtual users you need should be something you calculate based on the amount of load you expect in terms of hits/second, number of hits performed in per iteration (that number will be different depending on which scenario is executing) and the total amount of time it takes for your scenario to execute.
It’s not something you just guess.

Secondly: What is your rampup strategy?
A proper ramp-up should slowly add more load over time in an attempt to find the breaking point of the application. Putting all 1000 users on there simultaneously is a strategy that is bound to fail, especially if you don’t even know if “1000” is the right number in the first place.

I would advice you to start reading “Thinking Clearly About Performance” - http://queue.acm.org/detail.cfm?id=1854041 - before you continue down this path further.

Finally: These 4 user scenarios - is there really no overlap at all between these 4 categories? Will a user that adds data never delete data? Or vice versa? Are these things using entirely unrelated urls with completely different page layouts?

Maybe it’s just me but if you really want realism you should start considering the flow of user actions moving through your site, rather than strictly defining 4 broad categories and splitting everything into those 4 buckets. And with flow I mean documenting the relations between the pages. What page is hit first? What options does that page present to the user? How much of that entrance load then moves to each of the pages that that page links to?

Answer those questions, put the answers (or at least, reasonable guesses) in a flowchart or spreadsheet, then ask the exact same questions for each of the follow up pages until you either run out of pages or you are left with only pages that do not require you to test them.

And then, and only then, do you start writing that down as your script.

1.000 virtual users - why that particular number?

The number of virtual users you need should be something you calculate
based on the amount of load you expect in terms of hits/second, number of
hits performed in per iteration (that number will be different depending on
which scenario is executing) and the total amount of time it takes for your
scenario to execute.

Number of virtual users can be a concern if your app/website stores a lot
of information in the server user space (java: HttpSession) so that memory
is an issue. This way of building applications is usually the result of bad
practices ("hey, let's store everything in memory so we don't have to fetch
from the database, that will be faster!"), yet I sadly still meet a lot of
those.

Fully agree with everything else.

That is true, but if your testscript is close enough to reality it will answer the question of whether such ‘session exhaustion’ will be a problem in production even if you don’t make your test specifically target that resource. :wink:

Attaining ‘enough’ realism is a long and complicated subject though. There will always be tradeoffs involved.

100% realistic testing is only attainable in production, with real users accessing the production site.
At which point you’re no longer using gatling at all :wink:

(Note: I do not mean to propose for anyone to do performance testing in production. There are a million and a half reasons why you shouldn’t do that.
And for the select few people in this world where doing that is actually a serious option - if you don’t know whether you’re one of those, you’re almost definitely not one of those.)

Hi All,

I am new to GAtling .
I have a scenario where i have an excel with 1000 records and i have api call in gatling script to insert that record one-by-one to DB.
Now how many users , ramp up time should i set for this. ?

thanks for ur reply.

What are you trying to do? Are you trying to get the records into the DB, or are you trying to load test? If you are trying to load test, what specifically are you trying to do? The answer to your question depends entirely on your requirements.

Also, FYI, it’s a good idea not to reply to an unrelated and ancient post when starting a new thread. :slight_smile: