nodejs / nodejs/undici

Optimal Pooling Strategy

Open
#73 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement Pool
Dominant language
JavaScript
Stars
7.7k
Forks
880
Avg merge
2d 16h
Merged PRs (30d)
68

Description

What is the optimal strategy when picking the next client to perform a request on in the pool?

I believe the follow sorting criteria would be best:

const next = clients
  .sort((a, b) => {
    // connected
    if (a.connected !== b.connected) return a.connected ? -1 : 1
    // queue size
    if (a.size !== b.size) return a.size - b.size
    // drained timestamp
    if (a.drained !== b.drained) return b.drained - a.drained
    return 0
  })

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

The issue names no file, test, or entry point. First locate the pool's client-selection logic and compare its current behavior with the proposed connected, queue-size, and drained-time ordering; done requires an agreed strategy and corresponding validation.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.