async-kit icon indicating copy to clipboard operation
async-kit copied to clipboard

Ability to set minConnections for pool

Open MihaelIsaev opened this issue 6 years ago • 6 comments

It would be great to have an ability to configure minimum size of the connection pool

MihaelIsaev avatar Jun 22 '18 03:06 MihaelIsaev

Moving this to NIOKit since that is where ConnectionPool lives now.

tanner0101 avatar Feb 07 '19 22:02 tanner0101

How/when would this be beneficial? It’d still have a max and pick a new connection up when needed? Or would you always have x amount of connections connected?

MrLotU avatar Feb 19 '19 17:02 MrLotU

Might slightly decrease latency (especially in case of a sudden "burst" of parallel requests) because we are more likely to not need to fire up a new connection for these. But I agree that the semantics are a bit unclear per se, and it should also have less effect once the connection pool is "warm" (i.e. filled with as many connections are needed for regular operation).

MrMage avatar Feb 19 '19 17:02 MrMage

But while decreasing latency, would this not also increase the performance hit by keeping alive connections that are not needed? (I guess that'd be a tradeoff an end user would have to make)

MrLotU avatar Feb 19 '19 18:02 MrLotU

Yes, but the performance hit of excess idle connections should be negligible.

On 19. Feb 2019, at 19:02, Jari (LotU) [email protected] wrote:

But while decreasing latency, would this not also increase the performance hit by keeping alive connections that are not needed? (I guess that'd be a tradeoff an end user would have to make)

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

MrMage avatar Feb 19 '19 18:02 MrMage

I'm not into the whole performance world enough to judge that, so I'll take your word for that.

In this case it seems like a good addition, feel free to open a PR :)

MrLotU avatar Feb 19 '19 21:02 MrLotU