Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between sharing modes "All threads" and "Current thread group" in Jmeter

Tags:

jmeter

What is the actual difference between Sharing mode "All threads" and "Current thread group" in Jmeter?
Can anyone explain in detail?

I have one liner definition but i am not able to understand it properly.

Thanks, Rishil

like image 688
Rishil Bhatt Avatar asked Jan 24 '12 07:01

Rishil Bhatt


1 Answers

Well, as per reference:

 • All threads - (the default) the file is shared between all the threads. 
 • Current thread group - each file is opened once for each thread group in which the element appears

So in case of "All threads" if you have in your script more than 1 CSV Data Set Config elements that refer the same file the next CSV Data Set Config element will CONTINUE READING from previously opened file (i.e. in prevoius CSV Data Set Config element), and in case of "Current thread group" each subsequent CSV Data Set Config element will REOPEN your file.

Please look onto example below:

enter image description here

In this case each CSV Data Set Config element:
• uses the same csv-file;
• reads file once and till the EOF;
• reads file from beginning: file is re-opened each time because of Sharing Mode = Current thread group.

If in this case change Sharing Mode to "All threads" WITHOUT any other changes the 2nd (TG-04) and the 3rd (TG-05) CSV Data Set Config elements will read nothing because the csv-file will remain open after TG-03 and file cursor will point to end of file.

Implementation details find in CSVDataSet class description:

The class uses the FileServer alias mechanism to provide the different share modes. For all threads, the file alias is set to the file name. Otherwise, a suffix is appended to the filename to make it unique within the required context. For current thread group, the thread group identityHashcode is used; for individual threads, the thread hashcode is used as the suffix.


UPDATE 2012-02-09:
Presume you have configuration as in comment below:

  • N threads
  • 1 CSV Data Set Config
  • 1 csv data file
  • N entries in csv data file

So you will get:
1. N appearances - in case of Sharing mode = "All threads" or "Current thread group": each thread will read 1 entry from csv: the 1st thread - the 1st entry, ..., the Nth thread - the Nth entry.
2. N*N appearances - in case of Sharing mode = "Current thread": each thread will read ALL the entries from csv.

Both the statements are for the case when CSV Data Set Config set with the following settings:

Recycle on EOF? = false
Stop thread on EOF? = false

(screenshot above).

like image 175
Aliaksandr Belik Avatar answered Oct 25 '22 01:10

Aliaksandr Belik