Error when running more than 1 user

Hi, I’m stuck with this problem.
I’m having this problem when I run 2 VUs where it randomly pass and fail which I don’t really know what really happened… These 2 VUs has perform the same function except using different user data. The function it performs, contains several requests. And I have a data (contains params header) to use in setup() function.
Not to mention, throughout the function, I update and add some properties the data (add hash, token, id …) that passed from setup to default function,
Sometimes both VUs failed, rarely both passed, and lots of the time 1 passed and another failed. Also, when it failed, it failed in different requests of the function which I don’t know why. I log the request body and staff, and it looks fine to me the data for each VU is different from another throughout the requests.

My question are:

  • If data passed from setup() to default function to each VUs is a copy of its own. I can manipulate it without affecting another VU right?
  • Is this problem of the server that i’m requesting to or my fault that I update and add properties of data of setup() function?
  • How do I solve this?
    I used to run it single VU and it worked fine. Also, if I tried one VU at a time for that different user data, it also works fine. User data is not the issue to my understanding. It only occurs when there are more than 1 VU

Hi @sindaly123, wlecome to the community forum :tada: !

  • If data passed from setup() to default function to each VUs is a copy of its own. I can manipulate it without affecting another VU right?

Yes the setup data is not shared between VUs it is a copy of the one setup produces

  • Is this problem of the server that i’m requesting to or my fault that I update and add properties of data of setup() function?

As I said above - updating the setup data is not a problem as each VU has its own copy. Having more of what the responses and requests look like might help here. 2 VUs sounds awfully low for server issues, but I have heard of similar situation so :person_shrugging:

It only occurs when there are more than 1 VU

Does it happen with 2 VUs each doing just 1 iteration or do you need to a lot of them ?

Similarly, for 1 VUs - does it keep being stable if you run it for 10 minutes … for example.

It will be near impossible to just figure this out without more info. VUs are isolated, so they can’t really share data to write to - this is by design, so this should not be an issue you can hit. You might want to check you are running latest version - as we have had fixes over the years, although I don’t think any in the last year.

Any more info on what the requests do, what the application does - is it expected that the service will not handle (at least) a hundred users simultaneously?

Does the CPU/memory of the server go up? Maybe to 100%. Any error logs there?

hi @mstoykov, thanks you for responding. Sorry for not sharing much info because it’s confidential and I don’t to get into trouble.
All I share is that, I have a function that activate a user to for later use. In that function, it has 4 requests to complete the activation flow.
So, 1 VU no problem at all, but if I put more than 1 etc. 2 or 3, it’s doesn’t matter the iteration.
It happen on the first iteration. what really annoy me is that, the problem are different.

  • sometimes but rarely both fail at the first request, sometime one fail at the first request
  • lots of the time, one pass and another one fail at the second request (most of the time)
  • also sometimes and rarely both pass the test.

So I came up the a temporary situation as of now, I use try block to activate and if it fail,
I will redo the activate for that user again in the catch block. and it works. if it fail, it will redo activate in catch block again and work.

So, is this most likely the handling from the server side?

Really appreciate it!

I don’t really see how this can be a k6 issue that nobody else have noticed over all of these years - like you will need to hit something extremely specific which seems really unlikely IMO.

So yeah - it seems this seems like a server issue. At this small of load I expect you can probably hit the same issue with two bash scripts running curl commands ran in separate terminals or clicking in browser fast enough. So you might want to check that.

I tried using 2 devices to do the same thing, it is from server. Not from k6.
Thanks for pointing that out!

1 Like