Hi Interesting. What is the lifecycle of a Sampler ? i.e. if the Sampler has already completed , what happens when the interrupt occurs? Or if it moves on to the next sample (say if its in a loop) is that the same sampler instance or a new instance ? regards deepak
On Fri, Aug 28, 2015 at 6:54 AM, sebb <[email protected]> wrote: > The HTTP samplers support an interrupt method. > This is used when forcibly stopping a test. > > So one way to apply a timeout to a sampler is to interrupt it after > the timeout has elapsed. > > This can be done with a Timer using a scripting language such as BeanShell. > [Timers are run before the samplers to which they apply, and have > access to the current sampler through the context.] > > The following code is a very basic implementation for the BeanShell Timer: > > ===== cut here ===== > import java.util.concurrent.Executors; > sampler=ctx.getCurrentSampler(); > run=new Runnable() { > public void run() { > sampler.interrupt(); > } > }; > tpool = Executors.newScheduledThreadPool(1); > // schedule the interrupt to occur in 5 seconds from now > tpool.schedule(run, 5L, java.util.concurrent.TimeUnit.SECONDS); > return 0; // don't actually wait > ===== cut here ===== > > This works OK for me in some basic tests. > > Note that the sampler must implement Interruptible (the HTTP ones do). > > > On 24 August 2015 at 10:32, Khan, Sadat A <[email protected]> > wrote: > > that leaves me with checking the possibility to timeout the jmeter > command line in bash ( perhaps the timeout command ). > > > > regards > > > > Sadat Ali Khan > >> -----Original Message----- > >> From: Deepak Shetty [mailto:[email protected]] > >> Sent: Friday, August 21, 2015 8:52 PM > >> To: JMeter Users List > >> Subject: Re: http client timeout > >> > >> Hi > >> behavior of http.socket.timeout is the same - it also measures > inactivity I > >> guess you have asked this question before. Short of your own code , I > dont > >> think this is directly possible in Jmeter (unless its possible in > httpclient (but > >> not this parameter) > >> > >> regards > >> deepak > >> > >> On Fri, Aug 21, 2015 at 8:00 AM, Khan, Sadat A < > [email protected]> > >> wrote: > >> > >> > responses from my application are sent in chunks thereby rendering per > >> > sampler timeout not exactly useful for my use caseŠ > >> > > >> > regards > >> > > >> > Sadat Ali Khan > >> > > >> > On 8/21/15 7:36 PM, "Deepak Shetty" <[email protected]> wrote: > >> > > >> > >Hi > >> > >any reason why the Timeout on the sampler wont work for you > >> > >?(Response Timeout text in HTTP Sampler) If you are using the > >> > >httpclient implementation , then it should be possible to timeout the > >> > >sampler the way you are doing it - Though youll need to verify for > >> > >the version of httpclient you are using. > >> > > > >> > >regards > >> > >deepak > >> > > > >> > >On Fri, Aug 21, 2015 at 3:08 AM, Khan, Sadat A > >> > ><[email protected] > >> > > > >> > >wrote: > >> > > > >> > >> anything on this , please ? > >> > >> > >> > >> From: Khan, Sadat A > >> > >> Sent: Wednesday, August 12, 2015 5:20 PM > >> > >> To: JMeter Users List > >> > >> Subject: http client timeout > >> > >> > >> > >> hello, > >> > >> I need to timeout http requests in my test plan, after a > >> > >> certain period of time. Will setting the following property in > >> > >> httpclient.parameters file do the trick ? > >> > >> > >> > >> http.socket.timeout$Integer > >> > >> > >> > >> regards > >> > >> > >> > >> Sadat Ali Khan > >> > >> > >> > >> > >> > >> > >> > > >> >>******************************************************** > >> ************ > >> > >>***** > >> > >>********************************************** > >> > >> > >> > >> This email message and any attachments are intended solely for the > >> > >>use of the addressee. If you are not the intended recipient, you > >> > >>are prohibited from reading, disclosing, reproducing, distributing, > >> > >>disseminating or otherwise using this transmission. If you have > >> > >>received this message in error, please promptly notify the sender > >> > >>by reply email and immediately delete this message from your > >> > >>system. This message and any attachments may contain information > >> > >>that is confidential, privileged or exempt from disclosure. > >> > >>Delivery of this message to any person other than the intended > >> > >>recipient is not intended to waive any right or privilege. Message > >> > >>transmission is not guaranteed to be secure or free of software > viruses. > >> > >> > >> > >> > >> > > >> >>******************************************************** > >> ************ > >> > >>***** > >> > >>********************************************** > >> > >> > >> > > >> > > >> > > >> ********************************************************** > >> ************ > >> > ************************************************* > >> > > >> > This email message and any attachments are intended solely for the use > >> > of the addressee. If you are not the intended recipient, you are > >> > prohibited from reading, disclosing, reproducing, distributing, > >> > disseminating or otherwise using this transmission. If you have > >> > received this message in error, please promptly notify the sender by > >> > reply email and immediately delete this message from your system. This > >> > message and any attachments may contain information that is > >> > confidential, privileged or exempt from disclosure. Delivery of this > >> > message to any person other than the intended recipient is not > >> > intended to waive any right or privilege. Message transmission is not > >> guaranteed to be secure or free of software viruses. > >> > > >> > > >> ********************************************************** > >> ************ > >> > ************************************************* > >> > > >> > > >> > --------------------------------------------------------------------- > >> > To unsubscribe, e-mail: [email protected] > >> > For additional commands, e-mail: [email protected] > >> > > >> > > > > *********************************************************************************************************************** > > > > This email message and any attachments are intended solely for the use > of the addressee. If you are not the intended recipient, you are prohibited > from reading, disclosing, reproducing, distributing, disseminating or > otherwise using this transmission. If you have received this message in > error, please promptly notify the sender by reply email and immediately > delete this message from your system. This message and any attachments may > contain information that is confidential, privileged or exempt from > disclosure. Delivery of this message to any person other than the intended > recipient is not intended to waive any right or privilege. Message > transmission is not guaranteed to be secure or free of software viruses. > > > *********************************************************************************************************************** > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [email protected] > > For additional commands, e-mail: [email protected] > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > >
