Skip to content

ConnectionPool: Allow connection scoring/preference, for example for a certain EventLoopΒ #446

Open
@weissi

Description

@weissi

Description

A general connection pool works by first narrowing down the available connections to a set of 'acceptable' connections. That is usually done by matching a few required attributes like host/port/TLS configuration. But usually, not all connections in the resulting set are equally desirable for a client.
For example, a client may prefer a connection that is on a particular EventLoop (or not on one). We might call it EventLoop (anti-)affinity. Other attributes like a geographical/DC/... (anti-)affinity or a load factor sound entirely plausible too.

Especially for proxies, EventLoop affinity is very important because they may need to proxy thousands of concurrent requests which shouldn't force thread switches for every request.

Additionally, (thanks @Lukasa for mentioning) a client may have an idea of how long they might be willing to wait for a 'better' connection.

API ideas

  • One idea would be for the user of the connection pool to provide a scoring/sorting function about how much they like a certain connection. One idea would be score(Connection) -> Double (1.0: love it; 0.0: cannot use it) or orderConnectionAttractiveness(Connection, Connection) -> Bool

Metadata

Metadata

Assignees

No one assigned

    Labels

    ConnectionPoolFeatures and bugs that are related to the impl in ConnectionPoolModuleenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions