Inter-Thread Communication


JP@GC offers global string queues for inter-thread communication. These queues work in First-In-First-Out manner. You can put a string value into a queue from one thread, and then get that value from another thread, even in another Thread Group. This allows you having separate Thread Groups with some synchronization and parameter passing between them. There may be any number of FIFOs and they differ by "queue name".

PostProcessor & PreProcessor

Inter-thread communication plugins usually attached as a child of samplers that provide or utilize data transmission. Download example test plan that demonstrates the process.


There are 4 functions for inter-thread communication in JP@GC: fifoPut, fifoGet, fifoPop, fifoSize.

There is example test plan to see how it works.

fifoPut puts a value into queue and returns stored value. fifoPut parameters:

  1. Name of FIFO queue
  2. String to put into queue

Example, put 'str' into queue named 'sync_tokens':

${__fifoPut(sync_tokens, str)}

fifoPop gets the string value from FIFO and removes that item from the queue. If the item not exists, fifoPop will block and wait until some thread will make fifoPut into queue. There is timeout for such waits, by default it is unlimited, and can be changed by setting kg.apc.jmeter.functions.FifoTimeout property into value of seconds. If the timeout has been exceeded, "INTERRUPTED" value is returned.

fifoGet differs from fifoPop, it does not wait for data, just returns empty string if no data present in queue. Also it does not remove values from the queue. fifoSize returns the number of items in the queue.

fifoPop, fifoGet and fifoSize parameters:

  1. Name of FIFO queue
  2. Variable name to store value

Queue lengths by default is unlimited, but since 1.0.1 version there is capacity limit property kg.apc.jmeter.functions.FifoCapacity, put operations on full queue will block until next 'pop' operation or timeout.

Example, getting value from example of fifoPut:

# we take this value to use in IF controller to know if we have it
${__fifoPop(sync_tokens, gotToken)}

Note on Clearing Queues

For Plugins

PreProcessor and PostProcessor clear queues at test start and test stop.

For Functions

When you stop JMeter test, queues are not cleared automatically (if you haven't used Pre/PostProcessors), so when starting new test you may have some values from previous run in FIFOs. Queues are cleared with the first fifoPut call. To fight this issue you may choose queue names that changes with every test run (eg. relying on test start time, etc).


You can learn inter-thread communication by reading the "Async Download Tutorial".