Let me apologies in advance is someone has asked this question already and I missed it in my searches. But I am trying to understand how VU’s work with regards to the code in the default function, and how that might affect requests when using batch.
From what I have read, I am getting the impression that if I run my script with --vus 2, then all of the code in the default function will be run by two separate VU’s. Am I correct in my understanding?
The problem I am having is that the code that I have written has roughly three parts to it, a create, update and delete. I can choose the number of updates that take place using environment variables. On top of this, the code is reading an input file that contains a list of ID’s, so each part of the test (create, update, delete) uses these ID’s to build an array of requests, which is then passed into the batch function.
So, am I to understand that using more than one VU means that the batch statement will be executed n times, n being the number of VU’s? I am trying to understand this because I need to ensure that each request in the batch is only sent once.
Any guidance or point in the right direction would be greatly appreciated. **Disclaimer - I am a noob at k6 and java script…if you haven’t already guessed it.