简体   繁体   English

我们可以同时进行多少HTTP请求?

[英]How many HTTP request can we make simultaneously?

How many simultaneous HTTP request can I make at the same time? 我可以同时进行多少个同时的HTTP请求? Is there any rule from the underlying OS? 底层操作系统有什么规则吗? I am on Windows 7. For ex: If I start 100 threads, would they all execute at the same time? 我在Windows 7上。例如:如果我启动100个线程,它们是否会同时执行? If yes, does it depend on the amount of RAM or is it fixed irrespective of RAM size? 如果是,它是否取决于RAM的数量还是固定的,与RAM大小无关?

It depends, as usual... There are a few aspects to keep in mind here: 这与往常一样......这里要记住以下几个方面:

(1) How many threads can your PC/server handle at a time? (1)您的PC /服务器一次可以处理多少个线程? That is dependent upon memory, CPU power (number of cores for instance), what else your server is doing, and whether your threads do I/O-intensive work. 这取决于内存,CPU功率(例如内核数),服务器正在做什么,以及您的线程是否进行I / O密集型工作。 Using .NET, there are also different limits on the ThreadPool depending on the version (for instance for .NET 4: 1023 threads max in the 32-bit version, 32768 in the 64-bit version). 使用.NET,ThreadPool也有不同的限制,具体取决于版本(例如,对于.NET 4:32位版本中最大为1023个线程,64位版本中为32768)。

(2) Your Windows may also be configured to allow a maximum number of outgoing HTTP or TCP connections (Windows has a hard limit of 64K outgoing TCP connections if I'm not mistaken). (2)您的Windows也可能配置为允许最大数量的传出HTTP或TCP连接(如果我没有记错,Windows有64K传出TCP连接的硬限制)。

(3) If you are connecting via a proxy server, that proxy server too may impose limitations on outgoing connections. (3)如果您通过代理服务器进行连接,该代理服务器也可能对传出连接施加限制。 The same is true if you are passing a firewall; 如果您通过防火墙,情况也是如此; that too may block too many simultaneous outgoing connections. 这也可以阻止过多的同时传出连接。

(4) Are you opening all connections to the same server? (4)您是否打开了同一台服务器的所有连接? Because web servers have their limits too, and may be configured to only allow x number of incoming requests from a given source. 因为Web服务器也有其限制,并且可能配置为仅允许来自给定源的x个传入请求。

So I'm afraid you'll have to experiment to find out what the limits are in your case, unless you know these numbers. 所以我担心你不得不尝试找出你的情况有哪些限制,除非你知道这些数字。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM