Stepping thread group and graceful shutdown

3,089 views
Skip to first unread message

Volker

unread,
Sep 3, 2012, 8:17:29 AM9/3/12
to jmeter-...@googlegroups.com
Hello forum,

I recently tried the stepping thread group, it works quite fine. The test is set up as login, do something and logoff.
While running the test, I discovered a high number of open sessions in the tested application after the test finished, one session per thread.

It looks like the stepping thread group does a hard stop when time is up, rather than a graceful shutdown to have the current run complete. So as every running thread is killed at a random point in time, it cannot logoff, and an open session is kept.

Is there any chance to switch from stop to graceful shutdown (a property, checkbox, etc.)?

Thanks in advance
Volker

Andrey Pohilko

unread,
Sep 3, 2012, 10:36:02 AM9/3/12
to jmeter-...@googlegroups.com
Hi, Volker,

JMeter does not provide a way for stopping thread to execute a "shutdown sequence", they have tearDown Thread group instead. You should use it in your case.

понедельник, 3 сентября 2012 г., 16:17:29 UTC+4 пользователь Volker написал:

DanyC

unread,
May 1, 2013, 2:35:51 AM5/1/13
to jmeter-...@googlegroups.com
Andrey,
 
Is this still the case in the latest plugins version?
 
If yes, i couldn't find the TG you mentioned - tearDown Thread group ? Am i missing something?
 
 
Cheers,
Dani

Andrey Pohilko

unread,
May 1, 2013, 9:02:13 AM5/1/13
to jmeter-...@googlegroups.com, daniel...@gmail.com
maybe you use old JMeter version. tearDown appeared since 2.8

среда, 1 мая 2013 г., 10:35:51 UTC+4 пользователь DanyC написал:

vdab...@gmail.com

unread,
May 30, 2013, 4:27:32 AM5/30/13
to jmeter-...@googlegroups.com
Hi,

The JMeter script is attach to this post.

I use a beanshell and test to shutdown at this end the http sampler to test is time to stop.

Like this :
1) Thread Group with Infinity Loop (no sheduler)
2) A User Defined Variables with a variable call DURATION_BEFORE_STOP value 300 s (300 s or 5mn before gradual exiting)
3) After the logout (the last http sampler) corresponding to the end of the user navigation, i add a benshell sampler bsh verify if it is time to stop
The java code to set a variable call STATUS_THREAD to the value NEED_TO_STOP is the duration of the test is greather than DURATION_BEFORE_STOP, if it's not the time to stop the thread the STATUS_THREAD is set to CONTINUE

Java code in the beanshell sampler
startTest = props.getProperty("TESTSTART.MS");

long lStartTest = Long.parseLong(startTest);

// log.info("lStartTest = " + lStartTest);

sDURATION_BEFORE_STOP = vars.get("DURATION_BEFORE_STOP");

//log.info("sDURATION_BEFORE_STOP=" + sDURATION_BEFORE_STOP);

long lDurationBeforeStop = Long.parseLong(sDURATION_BEFORE_STOP) * 1000;

// log.info("lDurationBeforeStop=" + lDurationBeforeStop);
// log.info("lStartTest +  lDurationBeforeStop=" + (lStartTest +  lDurationBeforeStop));
// log.info("System.currentTimeMillis()=" +System.currentTimeMillis());

if ((lStartTest +  lDurationBeforeStop) < System.currentTimeMillis()) {
   vars.put("STATUS_THREAD","NEED_TO_STOP");
   log.info("STATUS_THREAD = NEED_TO_STOP");
}
else {
   vars.put("STATUS_THREAD","CONTINUE");
   log.info("STATUS_THREAD = CONTINUE");
}

4) An if controler that checks if STATUS_THREAD == NEED_TO_STOP
IF Controler condition
"${STATUS_THREAD}" == "NEED_TO_STOP"
5) Then "Test Action" set to Stop
Stop the current thread

Regards
Vincent D.
ExampleGradualExiting_v5.jmx

Rajani Pagadala

unread,
Nov 27, 2014, 12:33:16 AM11/27/14
to jmeter-...@googlegroups.com
Hi Volker,

Could you please share how to add multi JMX scripts to Setting Thred Group.

Thanks,
Raj
Reply all
Reply to author
Forward
0 new messages