Thursday, June 5, 2008

Howto Create a loop for Avalanche/Reflector

Loop
Use the LOOP action to execute a set of URLs multiple times, eliminating the need to cut and paste the same URLs repeatedly into your Action list. You can control the number of times you execute a loop by elapsed time (TIME) or by counting (COUNT) the number of times the loop runs.

If you use TIME, the Action list executes the URLs, and then checks the Time value you specify. If time remains, the Action list executes the URLs again. If not, it jumps to the LOOP STOP action. If you use COUNT, the URLs are executed repeatedly for the count that you indicate. For example, a count of five, executes the set of URLs five times.

You can also use the ASSIGN and APPLY actions to configure loops by assigning a variable name and then applying it to the COUNT value. A forms database can provide the variable value.

The Loop report, available in the summary.csv URL section of results, shows the minimum, maximum, and average response times. For more information, see Client URL Results.

TIP: To measures the amount of time in milliseconds that it takes to execute a list of URLS, use the TIMER action.


Syntax and Examples
Loop with counter
Syntax

LOOP loop_name START COUNT=number of loops

list of urls

LOOP loop_name STOP

loop_namean alphanumeric name that identifies the loop

number of loopsthe number of times you want to execute the URLS contained in the loop. When the count is reached, the action list jumps to the STOP LOOP action.

list of URLsthe set of URLS that you want to execute.

Example

The following loop executes a set of six URLs three times.

LOOP my_loop1 START COUNT=3

1 GET http://www.somewebsite.com/

2 GET http://www.somewebsite.com/images/about.gif

1 GET http://www.somewebsite2.com/

2 GET http://www.somewebsite.com/images/notes.gif

1 GET http://www.somewebsite3.com/

2 GET http://www.somewebsite3.com/images/welcome.gif

LOOP my_loop1 STOP

Loop with time
Syntax

LOOP loop_name START TIME=amount of time

list of urls

LOOP loop_name STOP

loop namean alphanumeric name that identifies the loop.

amount of timetime in milliseconds that the loop runs. If the time has expired, the action list jumps to the STOP LOOP action.

list of URLsthe set of URLS that you want to execute.

Example

The following loop repeatedly executes a set of six URLs for 200 milliseconds.

LOOP loopabc START TIME=200



1 GET http://www.somewebsite.com/

2 GET http://www.somewebsite.com/images/about.gif



1 GET http://www.somewebsite2.com/

2 GET http://www.somewebsite2.com/images/notes.gif



1 GET http://www.somewebsite3.com/

2 GET http://www.somewebsite3.com/images/welcome.gif

LOOP loopabc STOP

Loop with variable
Syntax

LOOP loop_name START COUNT=

list of URLs

LOOP loop_name STOP

loop namean alphanumeric name that identifies the loop.

variablea variable that sets the count. The variable has been assigned a value previously.

list of URLsthe set of URLS that you want to execute.

For more information about ASSIGN, APPLY and Forms Databases, see HTTP Assign Variables, HTTP Apply, and Using Forms Databases with Action Lists.

Example one variable

The following loop uses a variable to set the count to five.

ASSIGN VARIABLE

LOOP loopxyz START COUNT=APPLY loopvariable



1 GET http://www.somewebsite.com/

2 GET http://www.somewebsite.com/images/about.gif



1 GET http://www.somewebsite2.com/

2 GET http://www.somewebsite2.com/images/notes.gif



1 GET http://www.somewebsite3.com/

2 GET http://www.somewebsite3.com/images/welcome.gif

LOOP loopxyz STOP

Example nested loops, variable, forms database

The following example uses a nested loop that repeats the inner loop a number of times. Each time through the loop it executes the URLs.

When the inner loop exits, the myvar1 and inner_loop_counter variables are assigned new values from the Numbers.$1 and Numbers.$2 form databases respectively.

The outer loop repeats the assignment and inner loop sequence 10 times before exiting.

As an example, assume the inner loop counter is 10. The total number of requested URLs would then be equal to the outer loop (10) * inner loop (10) * number of URLs (6), or 600 requests.

ASSIGN VARIABLE

LOOP loop_outer START COUNT=APPLY outer_loop_counter

ASSIGN VARIABLE

ASSIGN VARIABLE

LOOP loop_inner START COUNT = APPLY inner_loop_counter



1 GET http://www.somewebsite.com/index.html?test=

2 GET http://www.somewebsite.com/pages/about.html?test=



1 GET http://www.somewebsite2.com/index.html?test=

2 GET http://www.somewebsite2.com/pages/notes.html?test=



1 GET http://www.somewebsite3.com/index.html?test=

2 GET http://www.somewebsite3.com/pages/welcome.html?test=

LOOP loop_inner STOP

LOOP loop_outer STOP

No comments: