Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide automatic background eviction of pooled objects #86

Closed
mbanaszkiewicz-vonage opened this issue Jul 3, 2020 · 2 comments
Closed
Labels
help wanted We need contributions on this type/enhancement A general enhancement
Milestone

Comments

@mbanaszkiewicz-vonage
Copy link

This suggestion comes from r2dbc-pool perspective: it would be nice to have something running in background in reactor-pool to evict objects after their TTL.

More context in this r2dbc-pool issue:
r2dbc/r2dbc-pool#6

@reactorbot reactorbot added the ❓need-triage This issue needs triage, hasn't been looked at by a team member yet label Jul 3, 2020
@simonbasle
Copy link
Member

simonbasle commented Jul 3, 2020

I think that makes sense, but I decided against adding such a reaper thread in the first release to avoid adding complexity until proven necessary.

There would also probably be a challenge in avoiding a "stop the world" aspect to a reaper thread while ensuring evicted resources are not passed to a pending acquire().

@simonbasle simonbasle added help wanted We need contributions on this type/enhancement A general enhancement and removed ❓need-triage This issue needs triage, hasn't been looked at by a team member yet labels Jul 3, 2020
@simonbasle
Copy link
Member

Challenge: the current implementation stores idle elements in a lock-free MPSC unbounded Queue that doesn't support iteration.

@simonbasle simonbasle added this to the 0.1.x Backlog milestone Jul 21, 2020
simonbasle added a commit that referenced this issue Oct 2, 2020
This commit adds an option for background eviction of resources in case
no activity is registered on the pool.

Note that the background eviction is best effort, and will back off
if there are concurrent release / acquire activity. The later actually
checks the eviction predicate too, which allows for some amount of
eviction to occur even if the background task has backed off.
simonbasle added a commit that referenced this issue Oct 5, 2020
This commit adds an option for background eviction of resources in case
no activity is registered on the pool.

Note that the background eviction is best effort, and will back off
if there are concurrent release / acquire activity. The later actually
checks the eviction predicate too, which allows for some amount of
eviction to occur even if the background task has backed off.
simonbasle added a commit that referenced this issue Oct 5, 2020
This commit adds an option for background eviction of resources in case
no activity is registered on the pool.

Note that the background eviction is best effort, and will back off
if there are concurrent release / acquire activity. The later actually
checks the eviction predicate too, which allows for some amount of
eviction to occur even if the background task has backed off.
simonbasle added a commit that referenced this issue Oct 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted We need contributions on this type/enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

3 participants