我们有一个系统client <-> server
通过 HTTP1.1 工作。客户端正在向服务器发出数百(有时数千)个并发请求。
由于浏览器对 HTTP1.1 连接的默认限制,客户端实际上是以批量(6 ~ 8)个并发请求的方式发出这些请求,我们认为如果我们可以增加并发请求的数量,我们可以获得一些性能提升.
我们将系统转移到通过 HTTP2 工作,我们看到客户端按照我们的意愿同时请求所有请求。
现在的问题是相反的:服务器无法处理如此多的并发请求。
我们如何限制客户端同时执行的并发请求数量,以便服务器更易于管理?假设 50 ~ 100 个并发请求。
我们假设 HTTP2 可以让我们毕业并发数 连接:
With HTTP/2 the client remains in full control of how server push is used. The client can limit the number of concurrently pushed streams; adjust the initial flow control window to control how much data is pushed when the stream is first opened; or disable server push entirely. These preferences are communicated via the SETTINGS frames at the beginning of the HTTP/2 connection and may be updated at any time.
也在这里:
也许,如果可能的话,我们可以在服务器端限制它(我认为更易于维护)。
但看起来这些解决方案正在谈论 Server Push我们所拥有的是客户端拉动。
如果有任何帮助,我们的架构如下所示:
Client ==[http 2]==> ALB(AWS Beanstalk) ==[http 1.1]==> nginx ==[http 1.0]==> Puma
最佳答案
关于ajax - 使用HTTP2如何限制并发请求数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55080915/