错误的网关错误 - fiddler 负载测试 / Visual Studio 2010

发布于 2024-11-05 05:43:42 字数 867 浏览 7 评论 0原文

我为远程服务器上托管的 Web 服务设置了两个测试来测量负载测试:其中一个使用 Web 工具(带有 StresStimulus 的 Fiddler)创建对服务器的多个请求测试,结果实际上令人惊讶,因为没有失败的尝试。 第二个是在 Visual Studio 中,我设置了 20 个线程,以 0.5 秒的间隔向服务器发出 200000 个简单的 GET httpweb 请求。我记录了失败的请求,大约有 3001 个错误网关错误 (502)。

谁能解释一下这个或者这两个测试完全不同吗?

        url = "http://192.xxxxxxx"
        webrequest = TryCast(System.Net.WebRequest.Create(url), HttpWebRequest)
        webrequest.Method = "GET"
        webrequest.UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.12) Gecko/20101026 Firefox/3.6.12 GTB7.1 ( .NET CLR 3.5.30729; .NET4.0E)"
        webrequest.Timeout = 60000
        webrequest.ContentType = "application/x-www-form-urlencoded"

        responseStream = webrequest.GetResponse().GetResponseStream()
        Dim reader As New StreamReader(responseStream)
        responseData = reader.ReadToEnd()

I set up two tests for a web service hosted on a remote server to measure loadtesting : one used a web tool (Fiddler with StresStimulus) to create multiple request tests to the server and the results were actually surprising in that there were no failed attempts.
The second was within visual studio where I set up 20 threads to make 200000 simple GET httpweb requests to the server with a 0.5 sec interval. I logged the failed requests and there were about 3001 bad gateway errors(502).

Can anyone explain this or did the two tests differ entirely?

        url = "http://192.xxxxxxx"
        webrequest = TryCast(System.Net.WebRequest.Create(url), HttpWebRequest)
        webrequest.Method = "GET"
        webrequest.UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.12) Gecko/20101026 Firefox/3.6.12 GTB7.1 ( .NET CLR 3.5.30729; .NET4.0E)"
        webrequest.Timeout = 60000
        webrequest.ContentType = "application/x-www-form-urlencoded"

        responseStream = webrequest.GetResponse().GetResponseStream()
        Dim reader As New StreamReader(responseStream)
        responseData = reader.ReadToEnd()

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

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

发布评论

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

评论(1

峩卟喜欢 2024-11-12 05:43:42

您应该能够比较两者。步骤如下:

  1. 在 StresStimulus 中,选择 200 个用户和 999 次迭代来创建与 VS 负载中相同的内容,即大约 200000 个请求。将迭代之间的思考时间设置为 1 秒并运行测试。仔细检查是否没有错误。

  2. 将 StresStimulus 测试导入 Visual Studio。在 Fiddler 将测试导出到 Visual Studio Web Test 文件中,将其添加到 VS 测试项目并使用负载参数运行测试,如 StresStimulus 中所示。查看是否出现任何错误。

  3. 将此测试转换为编码测试并再次运行。如果没有错误,请将代码与现有代码进行比较并检查它们有何不同。

  4. 最后,您可以通过 Fiddler 路由 VS 负载流量 设置代理 127.0.0.1:8888,然后将请求与 StresStimulus 重播的请求进行比较。

这应该为您提供足够的信息,以弄清楚为什么在一种情况下,serve 会向请求提供 502,但在另一种情况下不会。

You should be able to compare the two. Here are the steps:

  1. In StresStimulus select 200 users and 999 iterations to create the same as in VS load, around 200000 requests. Set think time between iteration to 1s and run the test. Double check that there are no errors.

  2. Import StresStimulus test into Visual Studio. In Fiddler export test into Visual Studio Web Test file, add it to your VS test project and run test with load parameters as in StresStimulus. See if you get any errors.

  3. Convert this test into a coded test and run again. If no errors, compare the code with your existing code and check how different they are.

  4. Finally, you can route VS load traffic through Fiddler by setting proxy 127.0.0.1:8888, and then compare the requests with ones that are replayed by StresStimulus.

This should give you enough information to figure out why serve gives 502 to requests in one case but not in another.

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