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

More information about deployment? #552

Closed
songololo opened this issue Oct 5, 2015 · 13 comments
Closed

More information about deployment? #552

songololo opened this issue Oct 5, 2015 · 13 comments
Labels

Comments

@songololo
Copy link
Contributor

As someone new to deploying websites, I'm wondering if it would be possible to provide more information about aiohttp deployment along with some recommended setups and settings, and some recommendations for when to use what type of setup given different goals. (e.g. websockets, CPU intensive apps, etc.)

What I've found so far:

  • There is a documentation page on deployment with gunicorn.
  • There are also some comments in various issues discussions suggesting that aiohttp can be deployed directly (without gunicorn) behind nginx as a reverse proxy / load balancer.
  • Some of the example files (websocket and multiprocess examples) use os.fork() to create child processes. I'm assuming that these examples would be used as a stand-alone deployment, presumably behind nginx?
@songololo
Copy link
Contributor Author

The Gunicorn approach seems to make sense. I've made some suggested edits to the Gunicorn deployment page in the hopes of making it a bit easier to understand for newcomers to Gunicorn and web deployment in general.

I'm still uncertain as to the deployment workflow if using the Supervisor / Child (with os.fork()) workflow shown in some of the aiohttp examples? I presume that these cases would be deployed directly behind nginx as a reverse proxy?

@asvetlov
Copy link
Member

asvetlov commented Oct 8, 2015

Yes, forked model is not intended to be run behind gunicorn.

@ludovic-gasc
Copy link
Contributor

About the fact to handle by yourself supervisor/multiworker pattern with os.fork(), I've started with that in API-Hour, finally, it was easier to subcontract that to Gunicorn.

If you serve only HTTP/Websocket, at least to me, Gunicorn deployment is the simplest way for newcomers.

However, launch several times your daemon on several ports and loadbalance HTTP queries with Nginx or HAproxy is also a good pattern, especially with HAproxy, because you can control precisely the loadbalancing behaviour in HAproxy.

@auvipy
Copy link

auvipy commented Dec 7, 2015

what about uWSGI?

@asvetlov
Copy link
Member

asvetlov commented Dec 7, 2015

What is the reason to run aiohttp behind uWSGI?

@auvipy
Copy link

auvipy commented Dec 7, 2015

same as running behind gunicorn. does aiohttp support self hosted deployment behind nginx?

@asvetlov
Copy link
Member

asvetlov commented Dec 7, 2015

  1. Gunicorn has dedicated aiohttp worker. uWSGI has no aiohttp support.
  2. Yes, aiohttp can be set up in self hosted configuration (like tornado). It's native mode for the library.

@auvipy
Copy link

auvipy commented Dec 8, 2015

wasn't aware!! thanks for sharing!

@songololo
Copy link
Contributor Author

Just to confirm, is it still recommend to use aiohttp.worker.GunicornWebWorker for the worker class instead of the built-in gaiohttp worker available in gunicorn?

@fafhrd91
Copy link
Member

fafhrd91 commented Dec 8, 2015

gaiohttp works only with wsgi and does not support aiohttp.web
we need to add wsgi support to aiohttp.worker.GunicornWebWorker and move it to gunicorn

@songololo
Copy link
Contributor Author

Thanks for the clarification.

@asvetlov
Copy link
Member

Fixed by 702dd0a

@lock
Copy link

lock bot commented Oct 29, 2019

This thread has been automatically locked since there has not been
any recent activity after it was closed. Please open a new issue for
related bugs.

If you feel like there's important points made in this discussion,
please include those exceprts into that new issue.

@lock lock bot added the outdated label Oct 29, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

5 participants