I have created a test case wherein I need to read files from a directory and for each file I need to invoke an HTTP request. So I created a Bean Sampler to list files in a directory and put that in a variable that will be used by a For each controller. I have kept HTTP requests inside For each controller so that for each file an HTTP request is invoked. The above works like a champ for one thread. When I update the thread count > 1, then I see a weird behavior that the number of HTTP requests is less than even the number of threads. I am expecting the HTTP request to be (no. of threads * no. of files * loop count).
Please let me know what is the problem.
I am attaching the screenshot for better illustration Thread Group
File folder = new File("D:\\OIT_FUNCTIONS\\inputSamples\\files\\large");
File[] files = folder.listFiles(new FileFilter() {
public boolean accept(File file) {
return file.isFile();
}
});
for (int i=0; i < files.length; i++) {
vars.put("file_" + i, files[i].getAbsolutePath());
MimetypesFileTypeMap fileTypeMap = new MimetypesFileTypeMap();
String mimeType = fileTypeMap.getContentType(files[i]);
vars.put("mime",mimeType);
}
If you see the Aggregate graph it can be seen that only 151 requests was called while 100 bean Sampler was called.
I am expecting [100(no.of threads) * no. of files * loop count] HTTP request to be called