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

How does hug interact with multiple (gunicorn) workers? #545

Open
gerrymanoim opened this issue Aug 19, 2017 · 0 comments
Open

How does hug interact with multiple (gunicorn) workers? #545

gerrymanoim opened this issue Aug 19, 2017 · 0 comments

Comments

@gerrymanoim
Copy link

Apologies if this is obvious, but I just can't seem to find any documentation.

From reading the docs and looking at PR #289 it seems that even though you can have async methods inside hug, all requests will be processed synchronously. If I understand that correctly, if I have an API endpoint that makes a request to a slow DB, the delay in serving that requests will always hold up subsequent requests.

However, if I use gunicorn (or similar server) in front of hug I can spin up multiple workers. Does that mean that a slow DB request being served by one worker won't impact requests hitting another worker? (Maybe depending on the worker type?) That's my reading of the gunicorn docs, but my tests were not conclusive.

In general, are there guidelines for writing performant hug APIs where particular endpoints are slow (external API requests or pyodbc queries)?

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

No branches or pull requests

1 participant