打开异步 HttpWebRequest 的最大数量
对于需要从互联网连接同时下载多个(25+)不同对象的客户端应用程序,应该使用的异步 HttpWebRequest 的最大数量是多少?使用多了会有什么后果?
For a client application that needs to download several (25+) different objects at the same time from an internet connect, what is the max number of async HttpWebRequests that should be used? What are the consequences of using more?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
确保请求的 ServicePoint.ConnectionLimit 足够高。
Make sure the request's ServicePoint.ConnectionLimit is high enough.
取决于您的服务器功能,但 Apache 允许您定义允许同时执行的最大请求数,因此您可以根据需要使用 MPM 配置中的 MaxClients 参数进行调整。还将 MinSpareServers 设置为至少 5
我使用:
并且 5 秒间隔内 25 个请求绝对没有问题。
Depends on your server capabilities, but Apache allows you to define maximum allowed requests executed at the same time, so you can tweak it up if necessary using MaxClients parameter in MPM configuration. Also set MinSpareServers to at least 5
I use :
and 25 requests in 5s interval is absolutely no problem.
好吧,我的问题可能不清楚。我想从客户端的角度了解 HttpWebRequest 对象,而不一定是从服务器的角度。
无论如何,我找到了问题的答案:
应该使用的异步 HttpWebRequest 的最大数量是多少?从我的测试来看,它取决于应用程序,但与多少个线程池线程是同一问题我的应用程序可以吗?
使用更多会有什么后果?你会得到一个可爱的 OOME :)
希望对某人有所帮助!
Ok, my question was probably unclear. I want to know from the client's perspective about the HttpWebRequest objects, not necessarily from the server's perspective.
Anyways, I found the answers to the questions:
what is the max number of async HttpWebRequests that should be used? From my tests, it depends on the application, but it's the same question as how many threadpool threads can my application have?
What are the consequences of using more? You get a lovely OOME :)
Hope that helps someone!