Getting Data from Database instead of CSV file

Hi team,
I was checking if its possible to read data from a data store like DB where my test data is stored and i want to read it from there , instead of parsing the csv data file . I want to read the same data from a database which will have the same data.

Hi @Shabd,

We have good experiences with users reading data from JSON and CSV, and this is what we would recommend. One of the main reasons would be that the load generator will load the DB and the load test might be bottle-necked by how fast it can get data back, or experience memory issues depending on the data set size. The SharedArray from JSON or CSV is definitely a better option.

That said, even if we have this GitHub issue Add database support · Issue #1019 · grafana/k6 · GitHub to track the ask for support in the k6 core for all databases, this is very unlikely to happen. You can find some suggestion on existing extensions for some databases in the comment: Add database support · Issue #1019 · grafana/k6 · GitHub.

Note that we also have the experimental redis extension, which you could use as data store.

I hope this helps.

Cheers!

1 Like