ConnectionPool: Allow connection scoring/preference, for example for a certain EventLoop #446
Labels
ConnectionPool
Features and bugs that are related to the impl in ConnectionPoolModule
enhancement
New feature or request
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
score(Connection) -> Double
(1.0: love it; 0.0: cannot use it) ororderConnectionAttractiveness(Connection, Connection) -> Bool
The text was updated successfully, but these errors were encountered: