-
Notifications
You must be signed in to change notification settings - Fork 138
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
Get Object from pool with priority #272
Comments
I suppose, just like a task priority proposal for tokio itself tokio-rs/tokio#3150 (as mentioned tokio-rs/tokio#3242 (comment) ), such a system is likely to want a custom scheduler to suite a specific application, so I guess that might might need to be considered? |
The synchronization primitive is a It's tempting to change the pool implementation from a passive pool to an active pool with a background worker. That would allow all sorts of fancy things. It would also add a non negligible amount of complexity to the project which I was always very careful not to add. I have to think about this for a bit... 🤔 |
I haven't looked into it in detail, but perhaps something like this could be achieved, at least proof of concept using a wrapper around the pool? |
In theory it should be possible to implement this using a priority queue (binary heap) of Wakers. Though there are many dragons lurking and implementing a proper and well tested synchronization primitive is hard work. While working on If anyone wants to give this a try I'd be glad to adopt this to |
Marking this issue |
I'm closing this for the time being as it is blocked by tokio-rs/tokio#3242. |
I was thinking, maybe it would be kind of nice to be able to specify a priority with a
pool.get_with_priority(n)
, that way I can force some tasks which tend to hog the connections to use them less than others, but when the others don't need them, then they have full access to the database.The text was updated successfully, but these errors were encountered: