A VuGen Solution for Timing HTTP Redirects

When performance testing demonstrates a bottleneck in an integration that is seamless to the end user, how do you pinpoint where the problem lies? On a recent project, I was asked to test the addition of a survey hosted at a third-party site. Once the user completed the survey and was redirected back to the page from which they were diverted, there were several seconds of delay.

As recorded, this “complete survey > process survey > return to original site” step was only one function:


To the end user, the process seemed to be simple. They clicked “Finish,” and returned to the page they were on before they began the survey. However, looking at the recording snapshot reveals a more complicated route involving a series of redirects:redirects

The first redirect was still on the third-party site. This step processed the survey answers. The second redirect was to the original site, returning the user to the page they were on before they took the survey. A replay of this process revealed the entire trip took in excess of eight seconds.

Because a performance problem was identified, it was important to pull out the redirects into their own function calls and wrap transaction timers around them. Did the problem lie on the third-party site or elsewhere? To find out, the solution below was implemented:

// Essentially, turn off redirects
	web_set_option("MaxRedirectionDepth", "0", LAST);

//Register a save parameter for the redirect location header	
		"LB=Location: ",

//Begin original transaction timer

//Begin a sub-transaction timer

//Submit survey answers
		"Referer= https://thirdpartysite.com/Survey/Page5.aspx?sid={cSurveyID}",
		"Name=__LASTFOCUS", "Value=", ENDITEM,
		"Name=__EVENTTARGET", "Value=", ENDITEM,
		"Name=__EVENTARGUMENT", "Value=", ENDITEM,
		"Name=__VIEWSTATE", "Value=", ENDITEM,
		"Name=ctl00$ContentHolder$hidFinish", "Value=1", ENDITEM,
		"Name=ctl00$ContentHolder$hidFinishButton", "Value=Next", ENDITEM,

//End the sub-transaction
lr_end_sub_transaction("AUT_T016_SubmitSurveyAnswers_001_SubmitAnswers ",

//Register a save for the redirect to the originating site, our application under test
		"LB=Location: ",

//Begin a sub-transaction timer

//In this case, the location header contained a relative path. Absolute path prefix was added	
	    "URL=https://thirdpartysite.com/{cRedirectProcessSurvey} ",
		"Referer= https://thirdpartysite.com/Survey/SubmitSurvey.aspx?sid={cSurveyID}",

//End the sub-transaction timer

//Return Max Redirection Depth to its original value
	web_set_option("MaxRedirectionDepth", "10", LAST);
//Begin the last sub-transaction timer

//The location header contained the absolute path back to the original site	
		"Referer= https://thirdpartysite.com/Survey/ProcessSurvey.aspx?sid={cSurveyID}",
//End last sub-transactions. You have all redirects timed now.

//End the original transaction timer.		
	lr_end_transaction("AUT_T016_SubmitSurveyAnswers", LR_AUTO);

When the changes were made to the script, a test was executed which found a bottleneck in the handshake that occurs between the third-party site and the application under test (the third step in the process or second redirect). Armed with this new information, I was able to help developers pinpoint the problem.

In most cases, it is not necessary to pull out redirects from the page which calls them. We are timing the experience of the end user as he or she moves through the application under test, and if a page redirects to another in a single end-user step, that entire process is the end-user experience and should be timed as such. Although in this case, developers needed to know the source of the bottleneck in the final step of the survey process. By temporarily turning off redirects, moving redirect URLs to their own web_url() calls, and creating sub-transaction timers, we solved the performance mystery.


Leave a comment