Asynchronous example - poll

For a list of protocols that support asynchronous communication, see 64-bit recording, Async, and IPv6 support.

The following example describes a Vuser script that includes a poll asynchronous conversation. The application that is emulated by the Vuser is a demo of a messaging service that sends updates on demand. The browser displays the page, and sends requests for updates at intervals of approximately 5 seconds.

Note: You can modify VuGen's asynchronous request thresholds to assist VuGen in finding poll-type conversations. For details, see Using asynchronous request thresholds.

The above script was generated by VuGen after the required business processes were recorded. An asynchronous scan was not performed on the script after the script was generated. Notice that the script contains a series of web_url functions with a repeating URL, namely: http://example.com/content/message.txt. These web_url functions are separated by lr_think_time functions, indicating that the web_url functions repeat at intervals of approximately 5 seconds.

When the Vuser script runs, requests for http://example.com/content/message.txt should be sent repeatedly until the script is finished. Additionally, these requests should be sent in parallel (simultaneously) with other actions performed in the Vuser script.

After VuGen performed a scan for asynchronous communications on the script, the script looks as follows:

Notice that a web_reg_async_attributes function has been added to the script before the first web_url function that calls http://example.com/content/message.txt, and that a web_stop_async function has been added after the last web_url function that calls the same URL.

Except for the first call to http://example.com/content/message.txt, all other web_url functions that call the same URL have been commented-out by VuGen.

Notice that the lr_think_time function has been replaced by the PollIntervalMs argument for web_reg_async_attributes.

The Snapshot pane for the remaining web_url function shows that the snapshots for the removed web_url functions now have Origin = Polling, and that they start at intervals of 5 seconds.

Back to top