Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/xpath/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 打开的异步HttpWebRequest的最大数目_C#_Asynchronous_Httpwebrequest - Fatal编程技术网

C# 打开的异步HttpWebRequest的最大数目

C# 打开的异步HttpWebRequest的最大数目,c#,asynchronous,httpwebrequest,C#,Asynchronous,Httpwebrequest,对于需要同时从internet连接下载多个(25+)不同对象的客户端应用程序,应使用的最大异步HttpWebRequests数是多少?使用更多的结果是什么?确保请求的ServicePoint.ConnectionLimit足够高。取决于您的服务器功能,但Apache允许您定义同时执行的最大允许请求数,因此您可以在必要时在MPM配置中使用MaxClients参数对其进行调整。还将MinPareServers设置为至少5个 我使用: Timeout 5 KeepAliveTimeout 2 <

对于需要同时从internet连接下载多个(25+)不同对象的客户端应用程序,应使用的最大异步HttpWebRequests数是多少?使用更多的结果是什么?

确保请求的ServicePoint.ConnectionLimit足够高。

取决于您的服务器功能,但Apache允许您定义同时执行的最大允许请求数,因此您可以在必要时在MPM配置中使用MaxClients参数对其进行调整。还将MinPareServers设置为至少5个

我使用:

Timeout 5
KeepAliveTimeout 2

<IfModule mpm_prefork_module>
StartServers 10
MinSpareServers 5
MaxSpareServers 50
MaxClients 100
MaxRequestsPerChild 20
</IfModule>
超时5
保持超时2
StartServers 10
MinSpareServers 5
MaxSpareServers 50
MaxClients 100
MaxRequestsPerChild 20

在5秒内有25个请求绝对没有问题。

好的,我的问题可能不清楚。我想从客户端的角度了解HttpWebRequest对象,而不一定是从服务器的角度

不管怎样,我找到了问题的答案:

应该使用的异步HttpWebRequests的最大数量是多少?根据我的测试,这取决于应用程序,但这与我的应用程序可以有多少线程池线程是同一个问题

使用更多会产生什么后果?您会得到一个可爱的OOME:)

希望这对别人有帮助