ChanGan
ChanGan

Reputation: 4318

How to pause sending request Jmeter for certain time when getting 502

I am currently doing performance Testing for the application.. We need to test with number of concurrent users (eg. 300). We are using Stepping Thread group and it is working fine..

The test is about 38 mins. At some point, when the server memory is overloaded the memory is cleaned and getting restarted takes 10 to 20 seconds during that time we are getting 502 - Bad Gateway response..

We have almost 6 Modules (each is in Transaction controller) and each controller has almost 20 to 30 api calls)

I just wanted to pause 20 seconds when first we encounter 502.. Is it possible to do that? I can use If controller but i can not add for all the 20 calls is that previous sample is OK which is time taking process. Is there any other way?

Upvotes: 0

Views: 904

Answers (1)

sergey.radov
sergey.radov

Reputation: 134

I would check ResponseCodes in PostProcessor and in case it is 502 Bad Gateway, I would get the current thread to sleep using Java Tread and Jmeter Api using

JMeterThread getThread() from JMeterContext.

 JMeterContext jmctx = JMeterContextService.getContext();
 JMeterThread currentThread = jmctx.getThread();
 currentThread.sleep(20000);

I am not sure about that currentThread.sleep(20000); because I need to check if JMeterThread inherits sleep() from Java Thread.

Checking it locally. more samples are here : https://www.programcreek.com/java-api-examples/?api=org.apache.jmeter.threads.JMeterContext

Upvotes: 1

Related Questions