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

Keep amount of concurrently created resources bounded #4

Open
qnikst opened this issue Nov 2, 2021 · 0 comments
Open

Keep amount of concurrently created resources bounded #4

qnikst opened this issue Nov 2, 2021 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@qnikst
Copy link
Member

qnikst commented Nov 2, 2021

The problem

The library may have problem in case of multiple concurrent requests came in together.

In this case we will allocate many resources at once. In case if new resource creation is costly (for example TLS connection initialisation) this may stress entire system, and increate overall resource creation time. This problem is not theoretical and we have faced it multiple times in production both in cloud and on premise systems.

Proposed solution

As it's not possible to know in advance the good strategy for all kinds of resources system, I propose to add an extra option for createPoolEx that will set the upper bound on amount of concurrently created resources, with Unbouded as a default [1].

This solution should play well with issue #3, as we will need to track threads that creates resources in that case.

Discussion

  1. Default value. For me Unbouded looks like a bad default choice, so user who didn't read the documentation may get in an emergency situation under unexpected load, however this way will preserve backwards compatibility, that is more relevant for the package.
  2. Limit score. Should we set a limit for an entire Pool or for the LocalPool aka stripe. I would suggest to set limit for a stripe, but maybe there are other considerations?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant