JMeter Inter-Thread Communication
Learn how to enable communication between separate thread groups in Apache JMeter using the FIFO queue plugin for advanced test scenarios.
Mark
Performance Testing Expert
Thread groups within Apache JMeter are designed to be self-contained units with private variables. This article explains how to enable communication between separate thread groups using a FIFO (First In, First Out) queue plugin.
Installation
- Download
plugins-manager.jarfrom jmeter-plugins.org - Place it in JMeter’s
lib/extdirectory - Restart JMeter
- Open Options > Plugins Manager
- Search for “fifo” and select “Inter-Thread Communication”
- Apply changes and restart
Available Elements
The plugin provides six components:
| Element | Description |
|---|---|
| Inter-Thread Communication PostProcessor | Queues an item |
| Inter-Thread Communication PreProcessor | Retrieves queued items |
| fifoPut | Adds items to queue |
| fifoGet | Reads without removal (returns empty string if queue is empty) |
| fifoPop | Reads and removes items (waits for data availability) |
| fifoSize | Displays queue item count |
Practical Example
Here’s how to create a two-thread-group test plan with inter-thread communication:
Thread Group 1 - Producer
- Add an HTTP Request sampler to fetch data
- Add a Boundary Extractor to extract values:
- Reference Name:
blogPost - Left Boundary:
<title> - Right Boundary:
</title>
- Reference Name:
- Add an Inter-Thread Communication PostProcessor:
- Queue Name:
myQueue - Variable:
${blogPost}
- Queue Name:
Thread Group 2 - Consumer
- Add an Inter-Thread Communication PreProcessor:
- Queue Name:
myQueue - Variable Name:
receivedValue
- Queue Name:
- Add your HTTP Request using
${receivedValue}
Configuration Tips
- Ensure Thread Group 1 starts before Thread Group 2
- Use the
fifoPopfunction for blocking reads (waits for data) - Use
fifoGetfor non-blocking reads (returns empty if no data) - Monitor queue size with
fifoSizeto prevent memory issues
Use Cases
- Passing authentication tokens between thread groups
- Coordinating dependent API calls
- Simulating producer-consumer patterns
- Sharing session data across user journeys
Further Reading
Tags: