You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Will Milspec <wi...@gmail.com> on 2011/05/19 17:37:07 UTC

Timers, Think Time between requests, and Best Practices

hi all,

My question pertains to use of timers to simulate "think time".

Here's a usecase : Use requests two urls:

          url1
              foo.html
              foo.css
              foo.js
          url2
              bar.html
              bar.css
              bar.js


I would like think time to apply only to "main request" (foo.html, bar.html)
not  the supporting requests (css, js). The reason: the browser downloads
these 'supporting' files immediately, not with a 2-5 second delay between
.html, .css, and .js


I understand from a coworker that:
a) if I put a timer at the start of a thread group, according to the
following setup, jmeter will randomize the interval between all requests
(i.e. including html, css, and .js)
b) one must manually edit the script to  add timers between foo.html,
bar.html ,etc.

questions:
a) Can someone confirm this
b) what's the easiest way to add think time (as described above) to a
script?


Example setup
ThreadGroup
  HttHeaderManager
  CSVData Set Config
  HttpCookieManager
  GaussianRandomTimer <--- Timer aedded at the start of the thread gropu
  Transaction Controller
      SimpleController
          url1
              foo.html
              foo.css
              foo.js
          url2
              bar.html
              bar.css
              bar.js
          url3
              baz.html
              baz.css
              baz.js

thanks

will

Re: Timers, Think Time between requests, and Best Practices

Posted by zillakilla <zi...@sogetthis.com>.
I think there are many ways of doing what you need but,
1 simple way is to use a ConstantThroughputTimer instead of the
GaussianRandomTimer 
This can assist with think time and also to calculate number of users
Knowing what the expected throughput vs actual throughput is also a useful
metric

example:
with 1 thread running, set the ConstantThroughputTimer to 60 reqs per min
(60 being: number of threads * 60 = 1 req per sec per thread)
So.... 1 thread = 1 req per sec

if you have a think time of say 6 secs... then 1 thread with a CTP of 60 =
10 users 
(or a think time of 4 secs ... then 1 thread = think time / 60 = 15 users)
If you did not get close to a total throughput of 60 reqs per min (1 req per
sec) then you know you have problems

 If i wanted to simulate 300 users using this logic (with think time = 6
secs), i would have 5 threads running in 1 thread group
with the ConstantThroughputTimer set to 300 (300 being: number of threads *
60 = 1 req per sec per thread)

Did it make sense?

HTH
zilla




--
View this message in context: http://jmeter.512774.n5.nabble.com/Timers-Think-Time-between-requests-and-Best-Practices-tp4410057p4413339.html
Sent from the JMeter - User mailing list archive at Nabble.com.

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


Re: Timers, Think Time between requests, and Best Practices

Posted by Will Milspec <wi...@gmail.com>.
Hi all,

Thanks for the response. I've looked over the code and the various options
in the http proxy and concluded this:

(Note this may be obvious to seasoned vets, but wasn't obvious to me as a
newcomer)


If you want to use "think time" with jmeter scripts recorded via the http
proxy server....

When setting up your http proxy server,
================================
* Grouping select the following: Put each group in a new transaction
controller

When setting up your thread test plan:
==================================
* put the timer (gaussian/uniform/etc) at the top of the test plan

Result
=======
The timer will apply to the first url in the transaction

Further notes
============
* Because we want our tests to download images/css, etc, I set the proxy
record er "Retrieve all embedded resources from html files" (if you want
jmeter to download css/gif/
* Cookie manager to make sure sessions persist between requests
* Cache manager simulates browser caching

Will

Re: Timers, Think Time between requests, and Best Practices

Posted by "Chian Zhong..." <cz...@modeln.com>.
Hi Will:

I'm using the timer the way you described here, so to confirm your question
a): yes. It is working for me so far.
b): I believe there are more complicated way to add timer to mimic the think
time, not easier ones that I know of.

Let's see if there are other tips.

Regards
Chian


On Thu, May 19, 2011 at 8:37 AM, Will Milspec <wi...@gmail.com>wrote:

> hi all,
>
> My question pertains to use of timers to simulate "think time".
>
> Here's a usecase : Use requests two urls:
>
>          url1
>              foo.html
>              foo.css
>              foo.js
>          url2
>              bar.html
>              bar.css
>              bar.js
>
>
> I would like think time to apply only to "main request" (foo.html,
> bar.html)
> not  the supporting requests (css, js). The reason: the browser downloads
> these 'supporting' files immediately, not with a 2-5 second delay between
> .html, .css, and .js
>
>
> I understand from a coworker that:
> a) if I put a timer at the start of a thread group, according to the
> following setup, jmeter will randomize the interval between all requests
> (i.e. including html, css, and .js)
> b) one must manually edit the script to  add timers between foo.html,
> bar.html ,etc.
>
> questions:
> a) Can someone confirm this
> b) what's the easiest way to add think time (as described above) to a
> script?
>
>
> Example setup
> ThreadGroup
>  HttHeaderManager
>  CSVData Set Config
>  HttpCookieManager
>  GaussianRandomTimer <--- Timer aedded at the start of the thread gropu
>  Transaction Controller
>      SimpleController
>          url1
>              foo.html
>              foo.css
>              foo.js
>          url2
>              bar.html
>              bar.css
>              bar.js
>          url3
>              baz.html
>              baz.css
>              baz.js
>
> thanks
>
> will
>