I am trying to understand how a FIFO queue of the inter-thread communication plugin for Jmeter works.
I made a simple test plan.
Added a setUp Thread Group
under which I added a JSR223 Sampler
with the following code:
def targetFIFOQueueName = "SYNC_FIFO_" + ${TESTSTART.MS}
log.info ("targetFIFOQueueName: " + targetFIFOQueueName)
props.put("targetFIFOQueueName", targetFIFOQueueName)
Then I added a classic Thread Group (default, just 1 thread, 1 loop), under which I added a JSR223 Sampler
with the following code:
${__fifoPut(props.get(targetFIFOQueueName),'variable1')}
Under this sampler, I added a JSR223 PreProcessor
and JSR223 PostProcessor
, both with the same debug code:
def targetQueueName = props.get('targetFIFOQueueName')
def queueSize = '${__fifoSize(props.get(targetFIFOQueueName))}'
log.info (queueSize.toString())
kg.apc.jmeter.modifiers.FifoMap.getInstance()['props.get(targetFIFOQueueName)'].eachWithIndex { entry, index -> log.info(targetQueueName + ' Queue has '+ 'entry # ' + index + ': ' + entry) }
In the end it looks like this:
You can see the JMeter log in the screenshot. I have highlighted the outputs from the preprocessor and postprocessor.
What I don’t understand is :
- Why does the preprocessor code execute without error in the first place (and does not throw and error, considering it should execute before the main sampler and in that case, I have not yet called the
fifoPut
function so then how does the queue exist in the first place…?) - The queue seems to start with 1 entry inside and when the main sampler gets executed (the one which actually contains the
fifoPut
function) another entry seems to be added (so I call fifoPut` function once but it gets executed twice). Why is this happening?
Any insight into this matter would be greatly appreciated.