Parallel HTTP Requests Blocked by Windows Registry
You are attempting to execute multiple HTTP requests concurrently in your application, but your performance is constrained. Investigating potential bottlenecks, you discovered that Windows may impose limits on concurrent requests.
To address this issue, you followed advice to modify registry values related to connection limits. However, despite making the adjustments and restarting your computer, your application still operates using only two TCP connections, limiting its throughput.
The question arises: why is the registry modification not working?
The information provided in the blog post you referenced is not entirely accurate. The registry keys mentioned, MaxConnectionsPerServer and MaxConnectionsPer1_0Server, are not directly related to the number of concurrent connections permitted. Instead, these keys control the maximum number of connections that can be held open to a specific server.
To control the maximum number of concurrent connections, you should use the ServicePointManager.DefaultConnectionLimit property. This property allows you to specify the maximum number of connections that a ServicePoint object can have. By default, this limit is set to 2.
To increase the connection limit, simply set the DefaultConnectionLimit property to the desired value. Here's an example:
ServicePointManager.DefaultConnectionLimit = 20;
This modification will raise the concurrent connection limit for all HTTP requests made through your application, enabling you to achieve the desired throughput.
The above is the detailed content of Why Isn't My Registry Modification Increasing Parallel HTTP Requests in Windows?. For more information, please follow other related articles on the PHP Chinese website!