Skip to content

Connection number always equals to the maximum pool size, even if all connections are idle and minimum-idle is 1 #2417

Description

@loicmathieu

Connection number always equals to the maximum pool size, even if all connections are idle and minimum-idle is 1.

In my application, connections are used for an SQL queue-like implementation, so they are used to poll a queue table frequently by multiple consumers.

When the queue table is empty, the poll query is done each second.
So each second, 20 consumers poll the queue and return immediately.
The connections are then idle most of the time.

Polling is not aligned between consumers, so I would expect that at some point, some connections will be freed but it never happens.
Which leads me to a question: how are idle connections taken from the pool? If it's always the oldest used connection, it explains everything.
In this case, I wonder if it would be possible to add a configuration option to always take the youngest connection, increasing the likelihood that idle connections are freed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions