-1

I have a JMeter script wherein the thread group has eight samplers and each sampler depends on the response of the preceding one. When I run this jmx script with 'Number of Threads' as one, it works fine but when I increase the number things fall apart and many requests fail as the sequence of execution breaks!

To handle this, as a Post Processor to my first sampler I added a Beanshell Post-Processor with ${__setProperty(ThreadValue,${__threadNum},)} in the script area. Then I kept the rest of the samplers in individual If Controllers with Condition as (${JMeterThread.last_sample_ok}==true) && (${__property(ThreadValue,,)} == ${__threadNum})

But now only the top two samplers get executed multiple times and the rest get executed only once! What maybe the reason?

2

You are doing something very weird. JMeter threads are totally independent and each thread has its own context, variables, cookies, etc.

So

  • If you have 1 thread - it will execute 8 requests in sequential order (upside down)
  • If you have 2 threads - each of 2 threads will execute 8 requests in sequential order
  • etc.

So I would recommend removing your Beanshell Post-Processor and If Controller as they are not required at all. If you need to perform some synchronization between different threads you should go for Inter-Thread Communication plugin (can be installed using JMeter Plugins Manager)


With regards to your question itself, as per documentation

Properties are not the same as variables. Variables are local to a thread; properties are common to all threads

So when you define the property it is defined globally and will be available to all threads until JMeter is restarted

  • So how do I execute 8 requests in a single thread group with a large 'Number of Threads (users)' like 100. Requests are processed fine with Number of threads as 1 but when the number is increased most of them fail! – Rohan Kalia May 22 '18 at 6:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.