I have a test with lot of socket connections (50K) and I intensionally want to keep the socket connection because my systeam broadcast messages and I need to test the load of that broadcast over 50k connected “users”… The problem is that not clossing the connection, the result is:
running (5m30.9s), 00000/50000 VUs, 0 complete and 50000 interrupted iterations
I tried with teardown but I couldn’t close the sockets from there…
Sorry, I think I got confused at the first read. Apologies!
I see, your problem is that if you close the socket within the “main” (default) function, it works as expected, but if you don’t, all the VUs remain blocked and although you can replicate the behavior of having multiple VUs connected concurrently (right?), the test doesn’t finish successfully.
Then, my question is: what is the “condition” that determines that the load test has concluded?
For instance, could you use your server, once you have tested what you need, confirmed that there are are up to X (50k?) clients connected, etc, to broadcast a extra message to all clients telling them they can be closed? Or alternatively, although not very efficient, could you use setTimeout with a “safe” value on each VU (in the “main” function) to close the socket after some time, and set k6’s duration/timeout with a higher value?