Random selection from CSV file in Jmeter

Andy Arismendi picture Andy Arismendi · Aug 28, 2013 · Viewed 23.9k times · Source

I have a very large CSV file (8000+ items) of URLs that I'm reading with a CSV Data Set Config element. It is populating the path of an HTTP Request sampler and iterating through with a while controller.

This is fine except what I want is have each user (thread) to pick a random URL from the CSV URL list. What I don't want is each thread using CSV items sequentially.

I was able to achieve this with a Random Order Controller with multiple HTTP Request samplers , however 8000+ HTTP Samplers really bogged down jmeter to an unusable state. So this is why I put the HTTP Sampler URLs in the CSV file. It doesn't appear that I can use the Random Order Controller with the CSV file data however. So how can I achieve random CSV data item selection per thread?

Answer

Ray picture Ray · Jun 25, 2014

There is another way to achieve this:

  • create a separate thread group
  • depending on what you want to achieve:
    • add a (random) loop count -> this will set a start offset for the thread group that does the work
    • add a loop count or forever and a timer and let it loop while the other thread group is running. This thread group will read a 'pseudo' random line

It's not really random, the file is still read sequentially, but your work thread makes jumps in the file. It worked for me ;-)