从Jmeter中的CSV文件中随机选择 [英] Random selection from CSV file in Jmeter
问题描述
我有一个非常大的CSV文件(8000多个项目),我正在使用CSV数据集配置元素读取该URL.它正在填充HTTP请求采样器的路径,并使用while控制器进行迭代.
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.
这很好,除了我想要的是让每个用户(线程)从CSV URL列表中选择一个随机URL.我不希望每个线程按顺序使用CSV项目.
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.
我能够使用带有多个HTTP Request采样器的随机顺序控制器来实现这一点,但是8000多个HTTP采样器实际上使jmeter陷入了无法使用的状态.所以这就是为什么我将HTTP Sampler URL放入CSV文件的原因.但是,我似乎无法将随机顺序控制器与CSV文件数据一起使用.那么如何实现每个线程随机选择CSV数据项呢?
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?
推荐答案
还有另一种方法可以实现:
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 ;-)
这篇关于从Jmeter中的CSV文件中随机选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!