[prev in list] [next in list] [prev in thread] [next in thread] 

List:       grinder-use
Subject:    Re: [Grinder-use] Thread ramp-up
From:       Tuvell_Walter () emc ! com
Date:       2009-05-08 14:32:46
Message-ID: 0F3F903BA6B4A54984787888AF6EA5C40256293B () CORPUSMX40A ! corp ! emc ! com
[Download RAW message or body]

--===============0148719503173982321==
Content-class: urn:content-classes:message
Content-Type: multipart/alternative;
	boundary="----_=_NextPart_001_01C9CFE9.DB45C66B"

This is a multi-part message in MIME format.


The concept of "user" is not a well-defined primitive in Grinder.  But
if we change "user" to "thread", then this is a question that has arisen
many times in this forum.
 
And as you know, Grinder has no built-in facility that implements thread
ramp-up.  But thanks to Jython, it's not hard to roll-your-own.  Below
is an outline of the way I do it.  Undoubtedly others have implemented
equally good ways.
 
 
 

	
########################################################################
	## At the top of your script, in the configuration portion of
your
	## script, define the following dict.
	
########################################################################
	 
	g_INITIALDELAY = {}  # def={}; {(thrMin1,thrMax1):sec1,
(thrMin2,thrMax2):sec2, ...}
	 
	 
	 
	
########################################################################
	## If you have a User Manual in your script (as I do), following
is the
	## documentation to include in it.
	
########################################################################
	 
	# - g_INITIALDELAY:
	#   Amount of time (in sec.) threads delay before they start
doing their
	#   test runs.  It is specifed as shown in the following
example:
	#       {(0,9):0*60, (10,19):5*60, (20,29):10*60,
(30,999):15*60}
	#   which means:
	#       threads # 0- 9 start immediately (0 delay, the default)
	#       threads #10-19 start at 5-min mark
	#       threads #20-29 start at 10-min mark
	#       remaining threads (if any) start at 15-min mark
	#   Threads in Grinder are numbered in the range
0..grinder.threads-1.
	#   Threads not specifed in g_INITIALDELAY have 0 delay (i.e.,
the
	#   default is to start immediately).  It is illegal to specify
more
	#   delays than grinder.threads.
	 
	 
	 
	
########################################################################
	## In the implementation portion of your script, validate the
g_INITIALDELAY
	## dict (to make sure the user specified legal params).
	
########################################################################
	 
	if not isinstance(g_INITIALDELAY, dict):
	    bailOut(99, lineno(), 'BAD g_INITIALDELAY!')
	for delaySpec in g_INITIALDELAY.keys():
	    if not (isinstance(delaySpec, tuple) and len(delaySpec)==2
and  \
	        isinstance(delaySpec[0],int) and
isinstance(delaySpec[1],int) and  \
	        0<=delaySpec[0]<=delaySpec[1] and  \
	        isinstance(g_INITIALDELAY[delaySpec],int) and
g_INITIALDELAY[delaySpec]>=0):
	        bailOut(99, lineno(), 'BAD g_INITIALDELAY!')
	 
	 
	 
	
########################################################################
	## To implement the ramp-up functionality, define a helper
vector variable,
	## g_INITIALDELAYvec.
	
########################################################################
	 
	# Get number of grinder threads.
	grinderProps = grinder.getProperties()
	threadsStr = grinderProps.get('grinder.threads')
	if threadsStr == None:
	    bailOut(99, lineno(), 'BAD grinder.threads (must be >= 1)!')
	else:
	    numWorkerThreads = int(threadsStr)
	    if numWorkerThreads <= 0:
	        bailOut(99, lineno(), 'BAD grinder.threads (must be >=
1)!')
	 
	g_INITIALDELAYvec = []
	for threadNum in range(numWorkerThreads):
	    g_INITIALDELAYvec.append(0)
	for delaySpec in g_INITIALDELAY:
	    threadNumLo, threadNumHi = delaySpec[0], delaySpec[1]
	    if threadNumHi > numWorkerThreads:
	        bailOut(99, lineno(), 'BAD g_INITIALDELAY (specifies
thread number > grinder.threads)!')
	    for threadNum in range(threadNumLo, threadNumHi+1):
	        g_INITIALDELAYvec[threadNum] = g_INITIALDELAY[delaySpec]
	 
	 
	 
	
########################################################################
	## Finally, in your TestRunner.__call__(), make your threads
sleep
	## before their initial runs, as follows.
	
########################################################################
	 
	def __call__(self):
	    if grinder.getRunNumber()==0:
	
java.lang.Thread.sleep(g_INITIALDELAYvec[grinder.getThreadNumber()]*g_th
ousand)
	        # Note: This sleep-time isn't counted in the Grinder
stats (which is a Good Thing).
	

 
 
 
________________________________

From: Sudhee.Dwivedi@steria.co.in [mailto:Sudhee.Dwivedi@steria.co.in] 
Sent: Friday, May 08, 2009 8:01 AM
To: grinder-use@lists.sourceforge.net
Subject: [Grinder-use] (no subject)




Hi
can i create ascenario where virtual user ramp up is variable. For e.g.
I want to start initially with 10 users. Run it for 5 mins then add 3
users again run (so total 13 users) run it for 3 mins. Add 2 users more,
run it for 5 mins and then end .
 
Plz reply asap
 
thanks and regards 
Sudhee
Think before you print - save energy and paper



This email originates from Steria*. It, and any attachments, may contain
confidential information and may be subject to copyright or other
intellectual property rights. It is only for the use of the
addressee(s). You may not copy, forward, disclose, save or otherwise use
it in any way if you are not the addressee(s) or responsible for
delivery.
If you receive this email by mistake, please advise the sender and
cancel it immediately.
Steria may monitor the content of emails within its network to ensure
compliance with its policies and procedures.
Any email is susceptible to alteration and its integrity cannot be
assured. Steria shall not be liable if the message is altered, modified,
falsified, or edited.
_____________________________________________________
* Steria Limited, number 4077975;
Steria Recruitment Limited, number 1437998.
Registered in England and Wales; registered office Three Cherry Trees
Lane, Hemel Hempstead, Hertfordshire HP2 7AH

www.steria.co.uk <http://www.steria.co.uk/> 


[Attachment #3 (text/html)]

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.3527" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><FONT face=Garamond color=#0000ff><SPAN 
class=334122414-08052009>The concept of "user" is not a well-defined primitive 
in Grinder.&nbsp; But if we change "user" to "thread", then this is a question 
that has arisen many times in this forum.</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Garamond color=#0000ff><SPAN 
class=334122414-08052009></SPAN></FONT>&nbsp;</DIV>
<DIV dir=ltr align=left><FONT face=Garamond color=#0000ff><SPAN 
class=334122414-08052009>And as you know, Grinder&nbsp;has no built-in facility 
that implements thread ramp-up.&nbsp; But thanks to Jython, it's not hard to 
roll-your-own.&nbsp; Below is an outline of the way I do it.&nbsp; Undoubtedly 
others have implemented equally good ways.</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Garamond color=#0000ff><SPAN 
class=334122414-08052009></SPAN></FONT>&nbsp;</DIV>
<DIV dir=ltr align=left><FONT face=Garamond color=#0000ff><SPAN 
class=334122414-08052009></SPAN></FONT>&nbsp;</DIV>
<DIV dir=ltr align=left><FONT face=Garamond color=#0000ff><SPAN 
class=334122414-08052009></SPAN></FONT><FONT face=Garamond color=#0000ff><SPAN 
class=334122414-08052009></SPAN></FONT><FONT face=Garamond color=#0000ff><SPAN 
class=334122414-08052009></SPAN></FONT>&nbsp;</DIV>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
  <DIV dir=ltr align=left><FONT face="Courier New" color=#0000ff size=1><SPAN 
  class=334122414-08052009>########################################################################<BR>## \
  At the top of your script, in the configuration portion of your<BR>## script, 
  define the following 
  dict.<BR>########################################################################</SPAN></FONT></DIV>
  <DIV><FONT face="Courier New" size=1></FONT>&nbsp;</DIV>
  <DIV dir=ltr align=left><FONT face="Courier New" color=#0000ff size=1><SPAN 
  class=334122414-08052009>g_INITIALDELAY = {}&nbsp; # def={}; 
  {(thrMin1,thrMax1):sec1, (thrMin2,thrMax2):sec2, ...}</SPAN></FONT></DIV>
  <DIV><FONT face="Courier New" size=1></FONT>&nbsp;</DIV>
  <DIV dir=ltr align=left><FONT face="Courier New" color=#0000ff size=1><SPAN 
  class=334122414-08052009></SPAN></FONT>&nbsp;</DIV>
  <DIV><FONT face="Courier New" size=1></FONT>&nbsp;</DIV>
  <DIV dir=ltr align=left><FONT face="Courier New" color=#0000ff size=1><SPAN 
  class=334122414-08052009>########################################################################<BR>## \
  If you have a User Manual in your script (as I do), following is the<BR>## 
  documentation to include in 
  it.<BR>########################################################################</SPAN></FONT></DIV>
  <DIV><FONT face="Courier New" size=1></FONT>&nbsp;</DIV>
  <DIV dir=ltr align=left><FONT face="Courier New" color=#0000ff size=1><SPAN 
  class=334122414-08052009># - g_INITIALDELAY:<BR>#&nbsp;&nbsp; Amount of time 
  (in sec.) threads delay before they start doing their<BR>#&nbsp;&nbsp; test 
  runs.&nbsp; It is specifed as shown in the following 
  example:<BR>#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {(0,9):0*60, (10,19):5*60, 
  (20,29):10*60, (30,999):15*60}<BR>#&nbsp;&nbsp; which 
  means:<BR>#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; threads # 0- 9 start 
  immediately (0 delay, the default)<BR>#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  threads #10-19 start at 5-min mark<BR>#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  threads #20-29 start at 10-min mark<BR>#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  remaining threads (if any) start at 15-min mark<BR>#&nbsp;&nbsp; Threads in 
  Grinder are numbered in the range 0..grinder.threads-1.<BR>#&nbsp;&nbsp; 
  Threads not specifed in g_INITIALDELAY have 0 delay (i.e., 
  the<BR>#&nbsp;&nbsp; default is to start immediately).&nbsp; It is illegal to 
  specify more<BR>#&nbsp;&nbsp; delays than grinder.threads.</SPAN></FONT></DIV>
  <DIV><FONT face="Courier New" size=1></FONT>&nbsp;</DIV>
  <DIV dir=ltr align=left><FONT face="Courier New" color=#0000ff size=1><SPAN 
  class=334122414-08052009></SPAN></FONT>&nbsp;</DIV>
  <DIV><FONT face="Courier New" size=1></FONT>&nbsp;</DIV>
  <DIV dir=ltr align=left><FONT face="Courier New" color=#0000ff size=1><SPAN 
  class=334122414-08052009>########################################################################<BR>## \
  In the implementation portion of your script, validate the 
  g_INITIALDELAY<BR>## dict (to make sure the user specified legal 
  params).<BR>########################################################################</SPAN></FONT></DIV>
  <DIV><FONT face="Courier New" size=1></FONT>&nbsp;</DIV>
  <DIV dir=ltr align=left><FONT face="Courier New" color=#0000ff size=1><SPAN 
  class=334122414-08052009>if not isinstance(g_INITIALDELAY, 
  dict):<BR>&nbsp;&nbsp;&nbsp; bailOut(99, lineno(), 'BAD 
  g_INITIALDELAY!')<BR>for delaySpec in 
  g_INITIALDELAY.keys():<BR>&nbsp;&nbsp;&nbsp; if not (isinstance(delaySpec, 
  tuple) and len(delaySpec)==2 and&nbsp; 
  \<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; isinstance(delaySpec[0],int) 
  and isinstance(delaySpec[1],int) and&nbsp; 
  \<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  0&lt;=delaySpec[0]&lt;=delaySpec[1] and&nbsp; 
  \<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  isinstance(g_INITIALDELAY[delaySpec],int) and 
  g_INITIALDELAY[delaySpec]&gt;=0):<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  bailOut(99, lineno(), 'BAD g_INITIALDELAY!')</SPAN></FONT></DIV>
  <DIV><FONT face="Courier New" size=1></FONT>&nbsp;</DIV>
  <DIV dir=ltr align=left><FONT face="Courier New" color=#0000ff size=1><SPAN 
  class=334122414-08052009></SPAN></FONT>&nbsp;</DIV>
  <DIV><FONT face="Courier New" size=1></FONT>&nbsp;</DIV>
  <DIV dir=ltr align=left><FONT face="Courier New" color=#0000ff size=1><SPAN 
  class=334122414-08052009>########################################################################<BR>## \
  To implement the ramp-up functionality, define a helper vector variable,<BR>## 
  g_INITIALDELAYvec.<BR>########################################################################</SPAN></FONT></DIV>
  <DIV><FONT face="Courier New" size=1></FONT>&nbsp;</DIV>
  <DIV dir=ltr align=left><FONT face="Courier New" color=#0000ff size=1><SPAN 
  class=334122414-08052009># Get number of grinder threads.<BR>grinderProps = 
  grinder.getProperties()<BR>threadsStr = 
  grinderProps.get('grinder.threads')<BR>if threadsStr == 
  None:<BR>&nbsp;&nbsp;&nbsp; bailOut(99, lineno(), 'BAD grinder.threads (must 
  be &gt;= 1)!')<BR>else:<BR>&nbsp;&nbsp;&nbsp; numWorkerThreads = 
  int(threadsStr)<BR>&nbsp;&nbsp;&nbsp; if numWorkerThreads &lt;= 
  0:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; bailOut(99, lineno(), 'BAD 
  grinder.threads (must be &gt;= 1)!')</SPAN></FONT></DIV>
  <DIV><FONT face="Courier New" size=1></FONT>&nbsp;</DIV>
  <DIV dir=ltr align=left><FONT face="Courier New" color=#0000ff size=1><SPAN 
  class=334122414-08052009>g_INITIALDELAYvec = []<BR>for threadNum in 
  range(numWorkerThreads):<BR>&nbsp;&nbsp;&nbsp; 
  g_INITIALDELAYvec.append(0)<BR>for delaySpec in 
  g_INITIALDELAY:<BR>&nbsp;&nbsp;&nbsp; threadNumLo, threadNumHi = delaySpec[0], 
  delaySpec[1]<BR>&nbsp;&nbsp;&nbsp; if threadNumHi &gt; 
  numWorkerThreads:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; bailOut(99, 
  lineno(), 'BAD g_INITIALDELAY (specifies thread number &gt; 
  grinder.threads)!')<BR>&nbsp;&nbsp;&nbsp; for threadNum in range(threadNumLo, 
  threadNumHi+1):<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  g_INITIALDELAYvec[threadNum] = g_INITIALDELAY[delaySpec]</SPAN></FONT></DIV>
  <DIV><FONT face="Courier New" size=1></FONT>&nbsp;</DIV>
  <DIV dir=ltr align=left><FONT face="Courier New" color=#0000ff size=1><SPAN 
  class=334122414-08052009></SPAN></FONT>&nbsp;</DIV>
  <DIV><FONT face="Courier New" size=1></FONT>&nbsp;</DIV>
  <DIV dir=ltr align=left><FONT face="Courier New" color=#0000ff size=1><SPAN 
  class=334122414-08052009>########################################################################<BR>## \
  Finally, in your TestRunner.__call__(), make your threads sleep<BR>## before 
  their initial runs, as 
  follows.<BR>########################################################################</SPAN></FONT></DIV>
  <DIV><FONT face="Courier New" size=1></FONT>&nbsp;</DIV>
  <DIV dir=ltr align=left><FONT face="Courier New" color=#0000ff size=1><SPAN 
  class=334122414-08052009>def __call__(self):<BR>&nbsp;&nbsp;&nbsp; if 
  grinder.getRunNumber()==0:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
  java.lang.Thread.sleep(g_INITIALDELAYvec[grinder.getThreadNumber()]*g_thousand)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
  # Note: This sleep-time isn't counted in the Grinder stats (which is a Good 
  Thing).<BR></SPAN></FONT></DIV></BLOCKQUOTE>
<DIV dir=ltr align=left><FONT face=Garamond color=#0000ff></FONT>&nbsp;</DIV>
<DIV dir=ltr align=left><FONT face=Garamond color=#0000ff></FONT>&nbsp;</DIV>
<DIV dir=ltr align=left><FONT face=Garamond color=#0000ff></FONT>&nbsp;</DIV>
<DIV dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> Sudhee.Dwivedi@steria.co.in 
[mailto:Sudhee.Dwivedi@steria.co.in] <BR><B>Sent:</B> Friday, May 08, 2009 8:01 
AM<BR><B>To:</B> grinder-use@lists.sourceforge.net<BR><B>Subject:</B> 
[Grinder-use] (no subject)<BR></FONT><BR></DIV>
<DIV></DIV><FONT face="Default Sans Serif,Verdana,Arial,Helvetica,sans-serif" 
size=2>
<DIV><FONT face=Garamond color=#0000ff size=3></FONT><FONT face=Garamond 
color=#0000ff size=3></FONT><FONT face=Garamond color=#0000ff 
size=3></FONT><FONT face=Garamond color=#0000ff size=3></FONT><FONT 
face=Garamond color=#0000ff size=3></FONT><FONT face=Garamond color=#0000ff 
size=3></FONT><FONT face=Garamond color=#0000ff size=3></FONT><BR>
<DIV>Hi</DIV>
<DIV>can i create ascenario where virtual user ramp up is variable. For e.g. I 
want to start initially with 10 users. Run it for 5 mins then add 3 users again 
run (so total&nbsp;13 users) run it for 3 mins. Add 2 users more, run it for 
5&nbsp;mins&nbsp;and then end .</DIV>
<DIV><FONT face=Garamond color=#0000ff size=3></FONT>&nbsp;</DIV>
<DIV>Plz reply asap</DIV>
<DIV><FONT face=Garamond color=#0000ff size=3></FONT>&nbsp;</DIV>
<DIV>thanks and regards </DIV>
<DIV>Sudhee</DIV></DIV></FONT>Think before you print - save energy and 
paper<BR><BR>
<P><FONT size=1>This email originates from Steria*. It, and any attachments, may 
contain confidential information and may be subject to copyright or other 
intellectual property rights. It is only for the use of the addressee(s). You 
may not copy, forward, disclose, save or otherwise use it in any way if you are 
not the addressee(s) or responsible for delivery.<BR>If you receive this email 
by mistake, please advise the sender and cancel it immediately.<BR>Steria may 
monitor the content of emails within its network to ensure compliance with its 
policies and procedures.<BR>Any email is susceptible to alteration and its 
integrity cannot be assured. Steria shall not be liable if the message is 
altered, modified, falsified, or 
edited.<BR>_____________________________________________________<BR>* Steria 
Limited, number 4077975;<BR>Steria Recruitment Limited, number 
1437998.<BR>Registered in England and Wales; registered office Three Cherry 
Trees Lane, Hemel Hempstead, Hertfordshire HP2 7AH</FONT></P>
<P><A href="http://www.steria.co.uk/">www.steria.co.uk</A></P></BODY></HTML>


[Attachment #4 (--===============0148719503173982321==)]
------------------------------------------------------------------------------
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image 
processing features enabled. http://p.sf.net/sfu/kodak-com

_______________________________________________
grinder-use mailing list
grinder-use@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/grinder-use


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic