开发者

Max number of open async HttpWebRequest

For a client application that needs to download several (25+) different objects at the same time from an internet connect, what is the ma开发者_开发问答x number of async HttpWebRequests that should be used? What are the consequences of using more?


Make sure the request's ServicePoint.ConnectionLimit is high enough.


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 :

Timeout 5
KeepAliveTimeout 2

<IfModule mpm_prefork_module>
StartServers 10
MinSpareServers 5
MaxSpareServers 50
MaxClients 100
MaxRequestsPerChild 20
</IfModule>

and 25 requests in 5s interval is absolutely no problem.


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!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜