In LR 11.04 Why does my winsock script take so long to execute.
Question ID: 105066
3
0

Currently using LoadRunner 11.04 and creating scripts with the "Winsock " protocol. After recording and enhancing my WinSock scripts successfully, the scripts take a long time to replay. Think times have been limited. Is there any recommendations or input on how I can further enhance / tune my current WinSock Scripts .

Marked as spam
Posted by (Questions: 108, Answers: 6)
Asked on July 18, 2013 5:45 pm
193 views
Answers (1)
3
Private answer

For all WinSock scripts, you will need to tune the script so that it waits long enough to get the first byte of the server response and then waits for a second period of time for the complete response to be received. In the case of a buffer mismatch for either size or content, LR will wait for the full time out period for each ''lrs_receive'' function call. This is why your script is taking so long. You have to wait for the correct timeout periods. If the timeout values are too short, the script will fail because of content issues. If the timeout periods are too long, you script will take a very long time to execute each iteration.

Use the following winsock calls to fine tune your script.

* lrs_set_recv_timeout:

Sets a timeout for receiving the expected data on a socket. The lrs_set_recv_timeout function sets the period of time that Vugen waits to receive expected data from a socket.

Note: Note that if, by this time, the buffer size does not match the expected data size (i.e. it is smaller or larger), lrs_receive will re-read the incoming data carried by the socket, until a second timeout has elapsed. For more information, see lrs_set_recv_timeout2.
By default the receive timeout is 10 seconds. The timeout is global for all sockets and is valid until the next invocation of lrs_set_recv_timeout. This function is not recorded during a WinSock session -you must manually insert it into your script.

* lrs_set_recv_timeout2:

Sets a timeout for receiving data on a socket after a connection was established.

The lrs_set_recv_timeout2 function sets a second timeout limit for receiving data on a socket. When lrs_receive receives the data buffer, it compares its size with the expected data. If the buffer size does not match, it performs additional iterations and rereads the incoming socket data, until the timeout2 limit is reached. You can view these iterations in the full log trace. This function allows you to customize the behavior of your script for different types of applications:

For example, applications that require a relatively long time for a reply, but once the server replies, the data is received at a quicker rate. In such a case, you can set the connection timeout using lrs_set_recv_timeout to a high limit, and the timeout for subsequent iterations to a lower limit using lrs_set_recv_timeout2.

For example, when you perform a query on a database server, it may take time for the server to process your request and return data. However, once the server begins to send data, it continues sending with almost no delay. Therefore, the receive timeout for the remainder of the data, timeout2, should be decreased.
Other applications connect to the server quickly, but the data transfer requires a longer period of time, such as in a heavily loaded network. In this case, you set lrs_set_recv_timeout to a low value and timeout2 to a higher value.

* lrs_set_receive_option:

The lrs_set_receive_option function sets a socket receiving option for all lrs_receive calls. The options indicates to finish receiving socket information-either after a mismatch or when it detects a terminating string. Note that this option does not apply to any receive operations handled with lrs_receive_ex. The options set by this function apply to all occurrences of lrs_receive after this function, unless the option is reset by a subsequent call to lrs_set_receive_option. This function is not recorded during a WinSock session-you manually insert it into your script.

For additional information on these and other WinSock function calls, please refer to the Vugen Help-->Function Reference. The reference includes call methods, properties, and examples.

Marked as spam
Posted by (Questions: 4, Answers: 41)
Answered on July 18, 2013 5:51 pm
EyeOnTesting

Welcome back to "EyeOnTesting" brought to you by Orasi Software, Inc.

X
Scroll to Top