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

Ahead of time object creation/recycling #167

Open
bikeshedder opened this issue Nov 5, 2021 · 3 comments
Open

Ahead of time object creation/recycling #167

bikeshedder opened this issue Nov 5, 2021 · 3 comments
Labels
A-core Area: Core / deadpool enhancement New feature or request
Milestone

Comments

@bikeshedder
Copy link
Collaborator

It would be nice if objects could be created and/or recycled ahead of time. I don't plan on making this feature mandatory but rather add some additional methods that can be used by 3rd party code to modify the pool state.

This future should be opt-in and not enabled by default as highly contested pools with large loads already perform exceptionally well. See https://github.com/bikeshedder/async-pool-benchmark

I would like the code that performs the ahead of time creation/recycling to work with public exposed APIs of the pool rather than being part of the pool implementation itself.

For that to work the pool will need at least one new method that provides access to the currently queued objects without removing them from the pool. For objects not part of the pool a new sync pre_return hook could be added that can be used to filter out objects. This hook could then either spawn a new async task taking ownership of the Object and call Object::take in order to discard it.

@JosiahParry
Copy link

I would also like this. For example if the max_size has not yet been reached, it would be great to have 1 additional and unused connection ready to handle any incoming requests if other connections in the pool are busy.

@bikeshedder bikeshedder modified the milestones: 1.0.0, 0.11 Sep 26, 2023
@bbigras
Copy link
Contributor

bbigras commented Oct 27, 2023

I would also like this. My shitty SQL database takes over 15 seconds to connect.

@JosiahParry
Copy link

@bbigras thank you for saying it like it is <3 boi do i feel that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-core Area: Core / deadpool enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants