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

Swap meta allocators with much more reserve. #202

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

aversecat
Copy link
Contributor

This is the core of the meta allocator swapping change: swap a little bit earlier, but always swap only when _freed is much larger than _avail.

From my observations I can see that without this change, both allocators bleed slowly to empty without either of them regaining enough over time to continue work. In effect, we never recover from ENOSPC. Everything grinds to a halt, the allocators just swap endlessly and transactions take forever to complete.

With this change we avoid all that - we purposely let our _avail allocator go much lower than _freed before we swap. This assures that whenever we swap we let enough blocks recycle post transactions into _freed so that it gets us out of ENOSPC again, and into a healthy state again.

I think.

We increase the reserve from 2x to 3x the minimum number of blocks
needed for our reserve, and change the algorithm that determines when
to swap them.

The old algorithm swaps them if _avail is just larger than _freed. While
the simplest algorithm, it suffers from the problem that in practice,
when we hit ENOSPC conditions, it will almost always swap on every
iteration when we hit our low water mark.

In our testing, we regularly see failures because what is effectively
happening is that we starve both allocators by slowly draining them
block by block, trying to do work. The work of course requires us to
drain more blocks to commit changes. This cycle doesn't end until both
allocators are almost completely drained and not enough blocks remain to
do any real work anymore.

The new algorithm will not swap allocators unless _freed is 50%
larger than _avail.

The outcome is that, during meta space pressure, we're allowing _avail to
slowly drain down to the same levels as before, effectively. However, we
then swap to _freed which is now 1.5x larger.

This results in us being able to do a whole chunk of work without
needing to swap. While draining _avail for longer, we allow work to
commit and recycle blocks back into _freed muich more effectively.

Signed-off-by: Auke Kok <[email protected]>
@aversecat
Copy link
Contributor Author

retest

1 similar comment
@aversecat
Copy link
Contributor Author

retest

@aversecat
Copy link
Contributor Author

retest

2 similar comments
@aversecat
Copy link
Contributor Author

retest

@aversecat
Copy link
Contributor Author

retest

@aversecat
Copy link
Contributor Author

Ironically, enospc failed on el7 vanilla, in the classic failure pattern.

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.

1 participant