hyperium / hyperium/hyper

hyper-util: Limit number of connections in Pool

Open
#3,785 0 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-feature
Dominant language
Rust
Stars
16.3k
Forks
1.8k
Avg merge
1d 22h
Merged PRs (30d)
14

Description

Is your feature request related to a problem? Please describe.
Connections pool may uncontrollably grow if client connects to many different hosts. There is a related issue in reqwest: https://github.com/seanmonstar/reqwest/issues/2424

Describe the solution you'd like
I can see a few options here:

  • Replace idle: HashMap<Key, Vec<Idle>> by LruCache<Key, Vec<Idle>> in PoolInner
  • Replace idle: HashMap<Key, Vec<Idle>> by LruCache<Key, Idle> in PoolInner

Describe alternatives you've considered
Maybe this problem shouldn't be solved at hyper-util's level and users of the library (or reqwest) should create separate clients for each host (or set of hosts).

Additional context
I'm happy to submit a PR for the issue if the feature would be considered as useful. I already implemented the change in my fork but I'm ok to update it or implement another solution.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with src/client/legacy/pool.rs, especially PoolInner and its idle HashMap. Compare the two proposed LruCache designs with the implementation in the linked fork, then seek agreement on which connection-bounding policy hyper-util should support. Done means an accepted design is implemented and its connection-growth behavior is validated.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
backend, networking
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.