-
Notifications
You must be signed in to change notification settings - Fork 1.8k
IO resource usage permit #6015
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
IO resource usage permit #6015
Conversation
a98195c
to
9656b26
Compare
// 000 - acquired | ||
// +++ - blocked on waiting | ||
// | ||
// Case: 1 indexation job at a time, long indexing | ||
// | ||
// IO limit = 1 | ||
// CPU limit = 2 Next optimization | ||
// │ loop | ||
// │ | ||
// ▼ | ||
// IO 0 00000000000000 000000000 | ||
// CPU 1 00000000000000000 | ||
// 2 00000000000000000 | ||
// | ||
// | ||
// IO 0 ++++++++++++++00000000000000000 | ||
// CPU 1 ++++++++0000000000 | ||
// 2 ++++++++0000000000 | ||
// | ||
// | ||
// Case: 1 indexing j0b at a time, short indexation | ||
// | ||
// | ||
// IO limit = 1 | ||
// CPU limit = 2 | ||
// | ||
// | ||
// IO 0 000000000000 ++++++++0000000000 | ||
// CPU 1 00000 | ||
// 2 00000 | ||
// | ||
// IO 0 ++++++++++++00000000000 +++++++ | ||
// CPU 1 00000 | ||
// 2 00000 | ||
// At this stage workload shifts from IO to CPU, so we can release IO permit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most important part is here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed in call.
We found two points of improvement:
- Use the same count in IO budget, and acquire the same amount of IO vs CPU. That keeps both in sync.
replace_with
can deadlock when re-acquiring the same resource
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙌
Are there some benchmark results to share to validate this patch? |
Not yet. I wanted to make them before merging |
Sorry! 🤡 |
* rename cpu_budget -> resource_budget * clippy * add io budget to resources * fmt * move budget structures into a separate file * add extend permit function * dont extend existing permit * switch from IO to CPU permit * do not release resource before aquiring an extension * fmt * Review remarks * Improve resource permit number assertion * Make resource permit replace_with only acquire extra needed permits * Remove obsolete drop implementation * allocate IO budget same as CPU * review fixes --------- Co-authored-by: timvisee <tim@visee.me>
Optimization is running in multiple stages. One stage is IO-heavy, another is CPU-heavy.
We want to utilize all types of resources at the same time, so we introduce a new type of resource budget, that allows other parallel processes to pick up IO-heavy phase without awaiting for CPU-heavy one