Skip to content

[RFC] ConnectionPool rewrite and http/2 support #376

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 10 commits into from

Conversation

fabianfett
Copy link
Member

This is a draft pr for a ConnectionPool reimplementation that opens the door for http/2 support. This pr has grown very large and I will need to split it up to actually land in parts. However I see benefit in showing the goal down the road. I would love some early feedback. The next step shall be to split code parts out that can go into code review on its own.

Goals

  • Reduce the number of pipeline modifications per request (There are no more pipeline modifications necessary)
  • Support http/2
  • Ease testing by creating explicit state machines.
  • No changes in public API at all

A high level overview:

  • HTTPConnectionPool is a new connection pool implementation for a single connection target (as in ConnectionPool.Key) replacing HTTP1ConnectionProvider
    • HTTPConnectionPool.StateMachine is the matching StateMachine for the HTTPConnectionPool. It has two potential substate machines:
      • HTTPConnectionPool.HTTP1ConnectionState for a remote targets that support http/1.1 only
      • HTTPConnectionPool.HTTP2ConnectionState for a remote targets that support http/2 only
    • HTTPConnectionPool.Connection is a box around the actual connection for HTTP1Connection and HTTP2Connection that is used in the connection pool state machine
  • HTTPConnectionPool.Manager is a new manager of all connection pools. (thus replacing ConnectionPool)
  • HTTPConnectionPool.Factory is responsible for creating new HTTP connections and replaces the connection setup currently in Utils.swift
  • HTTP1Connection is a wrapper around a Channel. A notable change to before is
  • HTTP1ClientChannelHandler is a new channel handler that can be reused for multiple requests.
    • HTTP1ConnectionStateMachine is a new state machine that is used by HTTP1ClientChannelHandler
    • During a request the HTTP1ConnectionStateMachine uses the HTTPRequestStateMachine as a substate machine.

State

  • All Logging related tests fail right now.
  • http/2 is disabled at the moment.
  • http/2 is very under tested
  • A few existing tests are commented out, since they rely on implementation details, that are not present in the new implementation.

@fabianfett fabianfett force-pushed the ff-h2 branch 2 times, most recently from 4aa41b2 to 22f04cb Compare June 17, 2021 14:17
@fabianfett fabianfett force-pushed the ff-h2 branch 2 times, most recently from 227d46e to 7956716 Compare June 18, 2021 07:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant