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

Add in a config option for api threadpool size #447

Merged
merged 5 commits into from
Feb 7, 2024
Merged

Conversation

Ktmi
Copy link

@Ktmi Ktmi commented Feb 7, 2024

Closes kytos-ng/mef_eline#406

Summary

Adds in a new threadpool called api. This is used to specify the number of threads used to handle API requests concurrently by the ASGI server. Also added in the configuration option api_concurrency_limit which specifies the maximum amount of concurrent requests to accept before requests are outright rejected.

Local Tests

Raising the api threadpool size allows for handling more API requests which depend on other api requests without locking up. Locking up still a possibility, but now possible to mitigate with a larger pool size here.

@Ktmi Ktmi requested a review from a team as a code owner February 7, 2024 14:56
Copy link
Member

@viniarck viniarck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Ktmi, great PR, I'm glad now we have safer concurrency default values.

I'm still under the impression that 80 is too low. Is it?

    1. Did you also tried/explored with higher values like 128/256/512 to get an idea? Probably upstream had a low-ish value for a reason, and I haven't researched much, but I'm interested to hear more about it. If with a larger pool it doesn't consume much extra mem and out of the gate it's less succeptable to potentially lock then that's great.
    1. Which case did you end end up facing a lock up that you highlighted in the description? I had the impression that with the concurrency and thread pool limit at least it wouldn't result in a lock up anymore, assuming ulimit file descriptions with a reasonable value too.

kytos/core/api_server.py Outdated Show resolved Hide resolved
CHANGELOG.rst Show resolved Hide resolved
@viniarck viniarck self-requested a review February 7, 2024 19:47
Copy link
Member

@viniarck viniarck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Ktmi, I'll leave it pre-approved. Just remaining the changelog discussion and linter is failing if you can fix it.

@Ktmi Ktmi merged commit 74a04b4 into master Feb 7, 2024
2 checks passed
@Ktmi Ktmi deleted the feat/api_pool branch February 7, 2024 21:53
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.

Creating/Deleting Too many EVCs at once will cause Kytos to lock up
2 participants