How to avoid SSL handshakes in load testing?
I am writing a load test project that makes a lot of HTTPS requests. Comparing to the result from HTTP requests, HTTPS requests are taking a lot more time in average page response time开发者_如何学Go. I'm suspecting that this is because every WebTestRequest that is sent goes through the whole SSL handshakes.
After digging around, I found out that there is something called HttpWebRequest.UnsafeAuthenticatedConnectionSharing property, which you can set to true for HttpWebRequest. As the msdn states,
If this property is set to true, the connection used to retrieve the response remains open after the authentication has been performed. In this case, other requests that have this property set to true may use the connection without re-authenticating.
This person also agrees that this property can actually allow me to analyze the page response time without SSL handshakes.
So, does anyone know how I can use HttpWebRequest.UnsafeAuthenticatedConnectionSharing property for WebTestRequest class?
or, is there any other ways to achieve the similar behavior with WebTestRequest class?
So, after more digging, I found out that Visual Studio (2008 in my case) has a load test setting called WebTest Connection Model under the Run Settings. It is set to Connection Per User by default. I changed it to Connection Pool. The average page response time has gone down to the point where it is similar to HTTP traffic, and I do not see any handshakes after the initial connections.
More about the WebTest Connection Model setting.
精彩评论