Iterating millions of records

Hi Team,

My test data is from 1- 10 million numbers
In load test script, I want to send unique http request each time with different number.
e.g.,, …

For reading & passing test data AFAIK there are 2 options-

  • Using Shared Array & read data from json file 1- 10 million
  • Get random int between 1- 10 million using Math.random()


  1. Out of above 2 options - Shared Array & Random int, which one is correct to use ?
  2. Are there any other options available ?
  3. Any sample website to download millions of records having only numbers e.g. 1,2,3 till 10 millions in .txt format ?


Hi @shailendrakumaromkar :slight_smile:
If you want to send unique request each time you can use:

import exec from ‘k6/execution’
let url =${exec.scenario.iterationInInstance + 1}

You will get unique request each time based on the number of the iteration in the scenario. The downsize of that approach is that the test will look the same each time. Unless you are 10M requests you might consider additional variables a, b such as (ax + b) is still in range (1, 10M) and x is exec.scenario.iterationInInstance.

Depending on how many requests you plan to send during a single run random function is also an option (low chances of getting the same request again):

Math.floor(Math.random() * (10000000 - 1) + 1)

1 Like