Performance of k6 VUs

Hi, one question, K6 creates all VUs when it starts? I mean, for example, if I want to run a load test with 500 max VUs I’m seeing that I get a lot of performance issues, tests starting time is really slow, It takes to much time in engine phase, also RAM consumption is really high almost 12MB.

Related to this, if I, for example, have a stage with 50 Vus over 20 seconds, when is the first vu going to start, after all, 50 vus are ready?

Yes all VUs are initialized at the beginning of the test. This is done as initializing a VU is CPU intensive operation, so in order for that to not influence the test results in the middle of execution we initialize all of them at the beginning.

Big portion of the initialization of the VU goes into execution of the js files - this is not executing the default function, but it runs the init code. This scales with the amount of js that you have and the more js there is the more time and ram it will use.

Maybe this PR will help you if you import the same file multiple times but I don’t know to what extend