如何避免负载测试中的 SSL 握手?

发布于 2024-10-17 21:02:20 字数 830 浏览 2 评论 0原文

我正在编写一个发出大量 HTTPS 请求的负载测试项目。与 HTTP 请求的结果相比,HTTPS 请求的平均页面响应时间要长得多。我怀疑这是因为发送的每个 WebTestRequest 都会经历整个 SSL 握手。

经过一番挖掘,我发现有一个叫做 HttpWebRequest 的东西.UnsafeAuthenticatedConnectionSharing 属性,您可以将 HttpWebRequest 设置为 true。正如 msdn 所说,

如果此属性设置为 true,则用于检索响应的连接在执行身份验证后保持打开状态。在这种情况下,将此属性设置为 true 的其他请求可以使用该连接,而无需重新进行身份验证。

此人也同意此属性实际上可以让我分析没有 SSL 握手的页面响应时间。

那么,有谁知道如何使用 WebTestRequest 类的 HttpWebRequest.UnsafeAuthenticatedConnectionSharing 属性?

或者,还有其他方法可以通过 WebTestRequest 类实现类似的行为吗?

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. 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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

噩梦成真你也成魔 2024-10-24 21:02:20

因此,经过更多挖掘,我发现 Visual Studio(我的例子是 2008)在运行设置下有一个名为 WebTest 连接模型 的负载测试设置。默认情况下,它设置为每个用户的连接。我将其更改为连接池。平均页面响应时间已下降到与 HTTP 流量相似的程度,并且在初始连接后我没有看到任何握手。

有关 WebTest 连接模型设置的详细信息。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文