Skip to content

hyper-util: deconstruct legacy Pool into composable Services #3849

Open
@seanmonstar

Description

@seanmonstar

The internal connection pool in the legacy client does many things, and it'd be better if it were broken up into several pieces and those made public, so people can more easily construct their own pools. Such as a racing cache pool, singleton pool for HTTP/2, an Either pool to combine them.

When looking how the legacy Client uses the pool, they easily fit into a MakeService (a Service that returns a Service) pattern. After "making" a service (the http1 or http2 (SendRequest, Connection) bit), a request is then sent, and afterwards the service is dropped. If pooling were disabled, that would just make a new connection each time. If a pool is used, likely that "made" service would return some internal pieces in its Drop implementation, so that making a new service later would reuse the existing connection.

This is likely a more complicated task, and a design document would be a good next step. I'll also add here some subtasks for individual pool types worth adding.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-clientArea: client.B-rfcBlocked: More comments would be useful in determine next steps.C-featureCategory: feature. This is adding a new feature.E-mediumEffort: medium. Some knowledge of how hyper internal works would be useful.K-hyper-utilCrate: hyper-util

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions