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

fix #86 Add background eviction #100

Merged
merged 3 commits into from
Oct 9, 2020
Merged

fix #86 Add background eviction #100

merged 3 commits into from
Oct 9, 2020

Conversation

simonbasle
Copy link
Member

No description provided.

@simonbasle simonbasle added this to the 0.2.0-RC2 milestone Oct 2, 2020
@simonbasle simonbasle requested a review from a team October 2, 2020 15:37
@simonbasle simonbasle changed the title fix #86 Add background eviction capability" fix #86 Add background eviction Oct 2, 2020
@codecov-commenter
Copy link

codecov-commenter commented Oct 2, 2020

Codecov Report

Merging #100 into 0.1.x will decrease coverage by 4.95%.
The diff coverage is 33.87%.

Impacted file tree graph

@@             Coverage Diff              @@
##              0.1.x     #100      +/-   ##
============================================
- Coverage     83.56%   78.61%   -4.96%     
- Complexity      139      140       +1     
============================================
  Files            10       11       +1     
  Lines           639      692      +53     
  Branches         98      105       +7     
============================================
+ Hits            534      544      +10     
- Misses           75      116      +41     
- Partials         30       32       +2     
Impacted Files Coverage Δ Complexity Δ
src/main/java/reactor/pool/PoolConfig.java 0.00% <0.00%> (ø) 0.00 <0.00> (?)
src/main/java/reactor/pool/SimpleDequePool.java 75.44% <15.38%> (-5.65%) 68.00 <1.00> (ø)
src/main/java/reactor/pool/DefaultPoolConfig.java 67.21% <38.46%> (-6.26%) 13.00 <1.00> (+1.00) ⬇️
src/main/java/reactor/pool/PoolBuilder.java 86.07% <57.14%> (-10.90%) 28.00 <1.00> (ø)
src/main/java/reactor/pool/AbstractPool.java 84.21% <0.00%> (-0.76%) 15.00% <0.00%> (ø%)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2139846...2e6f776. Read the comment docs.

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.

public class SimpleDequePoolStressTest {

@JCStressTest
@Outcome(id = "1001, 2, 0, 0", expect = ACCEPTABLE, desc = "evicted, acquired second resource")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

4 state variables make it really hard to reason about this test. Given that 1st and 3rd are always "1001" and "0", can't we get rid of them?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so, no. Both these validate that the pool correctly released the resource and that the accounting is correct. Maybe put them as 3rd and 4th variable since slightly less interesting than the second one (acquired)

@simonbasle simonbasle merged commit 80f346f into 0.1.x Oct 9, 2020
@simonbasle simonbasle deleted the 86-reaperThread branch October 9, 2020 12:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants