swift-server/async-http-client

[HTTP2] Count down available streams in HTTP2Connections

Opened this issue · 1 comments

Currently we don't make sure that we schedule a maximum of Int32.max/2 (= 1073741823) on a single HTTP2Connection. We should do so in the connection and regular communicate the remaining streams back to the HTTPConnectionPool.

To allow use cases like querying services behind AWS ALB we should also make the starting max number configurable for users. If a user knows they will use AWS ALB, they should be able to configure 10k max streams on the client.

AWS Application Load Balancer seems to send a GOAWAY after 10k streams:

▿ FramePayload
  ▿ goAway : 3 elements
    ▿ lastStreamID : HTTP2StreamID(19999)
      - networkStreamID : 19999
    ▿ errorCode : HTTP2ErrorCode<0x0 No Error>
      - _networkCode : 0
    - opaqueData : nil

The load balancer sends a response code of 000

With HTTP/2 connections, if the compressed length of any of the headers exceeds 8K bytes or if the number of requests served through one connection exceeds 10,000, the load balancer sends a GOAWAY frame and closes the connection with a TCP FIN.

https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-troubleshooting.html