Guide to K6 Scenario

Hello Community,

I have a K6 Test Scenario, where I have to login through 100 users and also collect auth_token and cookies for each user. Use this auth_token and cookies in multiple iterations of different file upload and download .

In Jmeter it would look like this
– Cookie Manager

  • Login Request
  • Auth Endpoint
    –Throughput Controller
  • file upload / download request ( 1 req per sec for each user for 30mins)

Can anyone suggest best scenario to use in K6 for above requirement?


Hi there,

you can do data parametrization via the k6/execution module. This will allow each VU to use a different token and cookies.

If your data is constant, you can use SharedArray to load it from e.g. a JSON file, as shown in the examples in the above link, or if you need to fetch it via HTTP, then you can do that in the setup() function. Since you’re only dealing with 100 VUs, you don’t really need SharedArray.

If you’re asking for which executor to use, since you want to test at a particular RPS, then the constant-arrival-rate executor might be a good fit for your test.

1 Like

Thanks for you quick response, I want to collect data for 100 different users. In setup(), I assume it will gather data only once and distribute to all vus. I will try shared array and first gather all data in shared-array and try to pass it to load test. If there is a better way for this or clean way. Eager to hear it.