2

We have a system client <-> server working over HTTP1.1. 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.

We moved the system to work over HTTP2 and we see the client requesting all the requests simultaneously as we wanted.

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.

We were assuming that HTTP2 can allow us to graduate the number of concurrent connections:

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.

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
fguillen
  • 36,125
  • 23
  • 149
  • 210

1 Answers1

2

There is special setting in SETTINGS frame

You can specify SETTINGS_MAX_CONCURRENT_STREAMS to 100 on the server side

Reference

AlexOwl
  • 869
  • 5
  • 11