jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebb <seb...@gmail.com>
Subject Re: http client timeout
Date Fri, 28 Aug 2015 13:54:01 GMT
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 <Sadat.Khan@altisource.com> 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:shettyd@gmail.com]
>> 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 <Sadat.Khan@altisource.com>
>> 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" <shettyd@gmail.com> 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
>> > ><Sadat.Khan@altisource.com
>> > >
>> > >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: user-unsubscribe@jmeter.apache.org
>> > For additional commands, e-mail: user-help@jmeter.apache.org
>> >
>> >
> ***********************************************************************************************************************
>
> 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: user-unsubscribe@jmeter.apache.org
> For additional commands, e-mail: user-help@jmeter.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
For additional commands, e-mail: user-help@jmeter.apache.org


Mime
View raw message