Load Runner

Load Runner – Correlation

After you have done all your home work and determined user scenarios and load profiles, you fire up your
performance tool and begin to simulate those scenarios. If using LoadRunner, when you record a session and the execute it, you have probably encountered errors such as “The same user can not login twice. ” or ” One user can only poll once .When this happens, this basically blocks your performance test and stops you from moving forward. These errors occur because a server cannot accept the same user executing the same action twice because many applications are designed to have precise statistics from each individual user, so if one user logs in 10 times (as you may try to simulate in a load test), the results do not conform with what the application expects and error messages are returned. Everyone encounters these types of problems and there are numerous ways to troubleshoot them. One such method is using correlation.

What is Correlation?

Firstly, what is correlation? As mentioned earlier, the server cannot or does not want to process the same user executing the same action consecutively. The same user has static data associated with that particular transaction and is hard-coded as a parameter of the transaction. Correlation is a process that converts the static data (or static session ID of the virtual user) to dynamic data and sends it to a server. This changes the session ID so that the server believes it is a new user. The screenshot in Figure 1 shows the correlation function when executing LoadRunner. The second column shows parameters of the recording snapshot while the third column shows the replayed snapshot. By comparing the difference between second and third columns , we can determine which parameters need correlation. Once we find this, then we need to determine which correlation method. There are two common methods for correlation: auto correlation and manual correlation.

Using Auto Correlation
For auto correlation, you need to click the Correlation Options link to set rules as Figure 1.

After setting these rules, you can select which parameter or session ID to correlate. Looking at Figure 1, there are four columns. The last column is indicates where the parameters occurred. You can click the Correlate button to get the exact list of differences as shown in Figure 2. The Text in Recording Snapshots and Text in Replay Snapshots columns show items such as different website address, different session ID, different IP address, etc.

Using Manual Correlation
Manual correlation is more difficult than auto correlation and requires several steps.First. You need to record two times using the same process and the same testing data. Then use the two recorded
scripts with the Windiff tool to find the difference. Windiff is an embedded tool in LoadRunner which can be
launched from Tools>Compare with Vuser. Upon finishing recording the script for the second time, you
can see the execution scripts as shown below in Figure 3. All codes are test scripts with the yellow bolded
background indicating the difference so that the user can track each difference.

After that, you can find the parameters in the Recording Log by using Ctrl+F. For example, you can find the sessionID by searching for the key words: 􀍞session􀍟. To determine where to insert the function, you need to run the script again with all logs enabled and then compare with the different lines for these 2 logs, as shown in Figure 3 where the yellow lines indicate the differences and tell you the exact location of the difference as well as the different content (such as http://www.abc.com with http://www.cba.com ).Then you need to define the left and right boundary in order to find the location where the lines are different. It
should be a string format and cover all or most codes if possible. For instance, you find the different words are session 1134 end session and session1245 end session the left boundary would be session and the right boundary would be end session. The whole function should be formatted as shown below.
web_reg_save_param(“UserSessio”, “LB= input type=hidden name=userSession value=”, “RB=>”, LAST)

The last step is to use “UserSession” instead of hard-code. For example,
“Name=userSession”, “Value={UserSession}”, ENDITEM,” instead of
“Name=userSession”, “Value=123″, ENDITEM,” (use parameter instead of a real value)
For more information, you can find details about this function from:
Help > Function reference>Contexts > Web and Wireless Vuser Functions > Correlation

Manual correlation is more difficult than auto correlation but in some situations we need to do this in order to troubleshoot and get better data for analysis. Auto correlation can show the difference between the 2 log files (We also need to run the script 2 times as in manual correlation.), but some differences may be displayed as a long encrypted string (i.e: 71238734) and you won’t be able to interpret the exact meaning or what it represents. On the other hand, with manual correlation you know the whole session structure as how the client transfers the data with the server and how many times the client and server communicated. For example, you can get the code as User IP address= 71238734 (note that 71238734 is encrypted and not a real IP address) using manual correlation, and then set a different IP for different users and successfully emulate many different users from different IP addresses visiting the server at the same time.

Categories: Load Runner

Leave a Reply