压力客户端:限制XP中的并发连接数

发布于 2024-07-12 06:03:43 字数 629 浏览 4 评论 0原文

我的网站有一个网络服务器,我正在尝试对其进行压力测试,但似乎做不到。 我认为问题在于XP(Pro)中的并发连接数有限。

我用C#写了一个简单的客户端进行压力测试:

...

for (int i = 0; i < _numThread; i++)
{

 Thread t = new Thread(CallGetHttp);

 t.Start(); 

}

...

private void CallGetHttp()

{

WebRequest wrGETURL;
 wrGETURL = WebRequest.Create(_url);

 WebProxy myProxy = new WebProxy("myproxy", 80);
 myProxy.BypassProxyOnLocal = true;

 wrGETURL.Proxy = WebProxy.GetDefaultProxy();

 Stream objStream;
 objStream = wrGETURL.GetResponse().GetResponseStream();

 StreamReader objReader = new StreamReader(objStream);

 ..
}

这样合适吗? 如果可以,如何增加并发连接数?

I have a web server with my web site and I am trying to stress test it but I don't seem to be able. I think that the problem is that there is a limited number of concurrent connections in XP (Pro).

I wrote a simple client in C# for stress testing:

...

for (int i = 0; i < _numThread; i++)
{

 Thread t = new Thread(CallGetHttp);

 t.Start(); 

}

...

private void CallGetHttp()

{

WebRequest wrGETURL;
 wrGETURL = WebRequest.Create(_url);

 WebProxy myProxy = new WebProxy("myproxy", 80);
 myProxy.BypassProxyOnLocal = true;

 wrGETURL.Proxy = WebProxy.GetDefaultProxy();

 Stream objStream;
 objStream = wrGETURL.GetResponse().GetResponseStream();

 StreamReader objReader = new StreamReader(objStream);

 ..
}

Is this proper? If so, how can I increase the number of concurrent connections?

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

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

发布评论

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

评论(1

猫卆 2024-07-19 06:03:43

连接限制是针对入站套接字的,并且它被硬编码到 XP 的网络堆栈中以防止它们被用作服务器(对于 Microsoft 来说更多的钱......)您唯一的选择是迁移到 Windows Server(如果您在 Microsoft 堆栈上),或者合法迁移如果你的代码支持linux的话。 如果您没有做任何过于具体的事情,请研究单声道。

还要小心落入虚拟PC陷阱。 Microsoft Virtual PC 的网络访问是通过 XP 网络堆栈进行的。 因此,如果您在 XP 内的虚拟机内运行 Linux,您仍然会受到 10 个入站连接的限制。

The connection limit is on inbound sockets, and it's hardcoded into XP's network stack to prevent them being used as servers (more money for Microsoft...) Your only choice is to move to Windows Server if your on a microsoft stack, or legally move to linux if your code will suppport it. Look into mono provided that your not doing anything too specific.

Also be careful to fall into the virtual PC trap. Network access from microsoft virtual PC is via the XP network stack. So if you run linux inside a VM inside XP, you're still constrained to the 10 inbound connections.

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