Distribute
The distribute tag allows you to efficiently distribute action execution over time. This tag will simulate execution distributions and record events when desired distributions were not achieved during the execution of underlying actions. When you use the id attribute you'll be able to get events back from this tag during its execution as to what interval of time failed to met the requested work goal.

Distribute can be used to create load patterns because the func attribute allows you to define precisely what type of load you want this tag to generate. The currently available functions are defined below and more can be added upon request.

Children Tags
(sequence | parallel | for | parallelloop | switch | distribute | try | timer | if | local | component | fail | choices | while | assert | result | testsuite | testscript | testproperty | record | event | query | nextresult | resetcursor | iterate | compare | filter | sort | log | stats | function | call | sleep | property | replace | diffproperty | createrange | unset | sleep | echo | fail | break | log | cat | monitor_create | monitor_destroy | monitor_grep | monitor_diff | event | attribute | http_get | http_post | http_put | http_head | http_delete | http_request | http_server | http_response | urlencode | replace | add | mod | abs | subtract | multiply | divide | share_create | share_destroy | share_get | share_set | share_wait | rendezvous_create | rendezvous_destroy | rendezvous_check | rendezvous_visit | rendezvous_reset | printf | scanf | headergroup | cookiegroup | http_config | read_image | seleniumopen | openwindow | close | type | submit | runscript | select | selectframe | selectwindow | click | clickat | doubleclick | doubleclickat | draganddrop | draganddroptoobject | mousedown | mousedownat | mousemove | mousemoveat | mouseout | mouseover | mouseup | mouseupat | createcookie | deletecookie | answeronnextprompt | choosecancelonnextconfirmation | chooseokonnextconfirmation | altkeydown | altkeyup | controlkeydown | controlkeyup | shiftkeydown | shiftkeyup | metakeydown | metakeyup | keydown | keyup | refresh | goback | windowmaximize | getalert | getallbuttons | getallfields | getalllinks | getallwindowids | getallwindownames | getallwindowtitles | getattribute | getattributefromallwindows | getbodytext | getconfirmation | getcookie | getcursorposition | getelementheight | getelementindex | getelementpositionleft | getelementpositiontop | getelementwidth | geteval | getexpression | gethtmlsource | getlocation | getmousespeed | getprompt | getselectedid | getselectedids | getselectedindex | getselectedlabel | getselectedlabels | getselectedvalue | getselectedvalues | getselectoptions | gettable | gettext | gettitle | getvalue | getwhetherthisframematchframeexpression | getwhetherthiswindowmatchwindowexpression | getxpathcount | setcontext | setcursorposition | setextensionjs | setmousespeed | setspeed | settimeout | addselection | removeselection | removeallselections | check | uncheck | waitforcondition | waitforframetoload | waitforpagetoload | waitforpopup){0,*}
Events
WORKER_ID Event
workdone
this field will contain the exact amount of work that was done during the unit of time identified by the workunit field.
workunit
this counts the number of units of work that were done and also lets you know for each event which unit of work was being handled.
workgoal
this field will contain the exact amount of work that was the goal during the unit of time identified by the workunit field.
Optional Attributes
workers
number of worker threads to use to try to guarantee the distribution specified. This value is under the control of the user and should be used wisely. If you start too many threads you can hose the system you're running the distribution on, but if you don't start enough then you can't meet your distribution requirements.
range
Similar to the way ranges are used in the for and parallelloop tags. Ranges are used here to identify the number of underlying threads used and assign them a unique id based on the ids in the range.
func
the actual distribution function to use during the execution of this test. The currently available distribution functions are:
Func Types
Type Description Example
const defines a constant distribution where the first argument to this function is the number of operations to guarantee for each unit of time.
  • const(10) would try to execute 10 operations per unit of time specified with the attribute unit.
step defines a step function for the distribution, where the first argument is the starting value, the second argument is the stepping size and the 3rd argument is the duration of each step.
  • step(1,1,10) would start by executing 1 operation per unit of time and then up by 1 operation every 10 units of time.
  • step(0,10,1) would start by executing 0 operation per unit of time and then up by 10 operation every 1 units of time.
list defines a list of the values, where each value is the exact amount of operations per unit of time to do in each unit of time. The values of this list are used once per unit of time till we reach the end and then we just jump back to the start of the list.
  • list(0,20,25,20) would try to execute 0 operations for the unit of time 0 and then 20 at time 1, 25 at time 2 and then 20 at unit of time 3, followed by starting from the beginning of the list.
limit this function will limit the underlying distribution function to a certain number so that it can't go over that.
  • limit(step(0,20,1),60) would basically start at 0 operations per unit of time and then increases by 20 operations every unit of time until we hit 60 at which will just stay constant at 60 operations per unit of time.
iterations
the number of iterations to run for. Once reached the test will come to an end even if there is a value for the timer property.
timer
time based execution can be achieved with this property, just put a value in the format of 1s, 2h or 3d (3 days) and the distribute tag will keep executing the underlying action till at least that much time has gone by.
property
the property to save the current iteartion value in. This is useful for generate unique identifiers in each of the underlying executions. This property is guaranteed to be unique throughout the whole run even with parallelized access to the value. The iteration property always starts at 1.
id
the id attribute is used to generate the events being thrown about the work that was and wasn't completed during the execution of this distribution. Those events are defined in the previous event section. The id also makes the property ${[your distribute id].worker} available and allows you to identify during each execution which worker (i.e. thread) was handling the request....
Usage Examples
Example #1
<distribute func="const(20)" id="dist1" property="iter" range="1..5" timer="5m" unit="1m">
   
<log>Executing action from thread ${dist1.worker}!</log>
</distribute>
Example #2
<distribute func="list(10,20,50,20,10)" id="dist1" property="iter" range="1..32" timer="5m">
   
<log>Executing action from thread ${dist1.worker}!</log>
</distribute>