[英]Using HTTP2 how can I limit the number of concurrent requests?
We have a system client <-> server
working over HTTP1.1.我们有一个通过 HTTP1.1 工作的系统
client <-> server
。 The client is making hundreds (sometimes thousands) of concurrent requests to the server.客户端向服务器发出数百(有时数千)个并发请求。
Because the default limitations of the browsers to HTTP1.1 connections the client is actually making these requests in batches of (6 ~ 8) concurrent requests, we think we can get some performance improvement if we can increase the number of concurrent requests.因为浏览器对 HTTP1.1 连接的默认限制,客户端实际上是分批(6~8)个并发请求发出这些请求,我们认为如果我们可以增加并发请求的数量,我们可以得到一些性能提升。
We moved the system to work over HTTP2 and we see the client requesting all the requests simultaneously as we wanted.我们将系统移到 HTTP2 上工作,我们看到客户端根据我们的需要同时请求所有请求。
The problem now is the opposite: the server can not handle so many concurrent requests.现在的问题恰恰相反:服务器无法处理这么多并发请求。
How can we limit the number of concurrent request the Client is doing simultaneous to something more manageable for the server?我们如何将客户端同时执行的并发请求数量限制为服务器更易于管理的事情? let's say 50 ~ 100 concurrent requests.
假设 50 ~ 100 个并发请求。
We were assuming that HTTP2 can allow us to graduate the number of concurrent connections:我们假设 HTTP2 可以让我们对并发连接数进行分级:
With HTTP/2 the client remains in full control of how server push is used.
使用 HTTP/2,客户端可以完全控制服务器推送的使用方式。 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.
这些首选项通过 HTTP/2 连接开始时的 SETTINGS 帧进行通信,并且可以随时更新。
Also here:也在这里:
O maybe, if possible, we can limit this in the server side (what I think is more maintainable).哦,如果可能的话,我们可以在服务器端限制它(我认为更易于维护)。
But looks like these solutions are talking about Server Push and what we have is the Client Pulling.但看起来这些解决方案是在谈论服务器推送,而我们所拥有的是客户端拉取。
In case help in any way our architecture looks like this:如果有任何帮助,我们的架构如下所示:
Client ==[http 2]==> ALB(AWS Beanstalk) ==[http 1.1]==> nginx ==[http 1.0]==> Puma
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.