1

I have a folder with many JSON-Files and I would like to send them parallel to a Webservice using jmeter.

I already used a BeanShell Sampler to collect the files into jmeter-variables. Then I used a ForEach Controller to perform the HTTP Request (see this thread).

But the problem is, when using a thread count > 1, the json-files are processed multiple times. Each thread loops through the list of JSON-files for its own.

Do you know how multiple threads can share the output variable of a ForEach Controller?

See jmeter configuration

jmeter configuration. There are 3 (threads) * 2 (files) = 6 debug outputs. But I would like that e.g. thread 1 processes first.json, thread 3 processes second.json and thread 2 does not have any left. So no file is processed multiple times.

1 Answer 1

1

The easiest way of implementing your requirement is using Directory Listing Config plugin.

The plugin reads all the files from the folder provided into a single JMeter variable:

enter image description here

As you can see in the above setup 3rd user doesn't execute the sampler as the folder contains only 2 files and both have been processed already:

enter image description here

You can install Directory Listing Config plugin using JMeter Plugins Manager

enter image description here

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you! Works like a charm!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.