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 note about production deployment #234

Closed
ariddell opened this issue Jan 13, 2015 · 8 comments
Closed

Add note about production deployment #234

ariddell opened this issue Jan 13, 2015 · 8 comments
Labels

Comments

@ariddell
Copy link

Users of the aiohttp server coming from bottle or flask may be concerned about performance and deployment (both bottle and flask have sections called "Deployment" or similar). If aiohttp's web server is fine to use in production, perhaps a note could be added to state this?

I'd be willing to perform a simple benchmark (against, say, cherrypy) but I suspect this has already been done. Has it?

For reference, this is the deployment section for bottle: http://bottlepy.org/docs/dev/deployment.html

@asvetlov
Copy link
Member

You can use aiohttp in production.
We just run it under nginx (used as load balancer and static files handler, see http://nginx.com/resources/admin-guide/load-balancer/).

I have not finishing benchmarking but have semi-ready code in https://github.com/KeepSafe/aiohttp/blob/master/benchmark/async.py

@ariddell
Copy link
Author

That's what I suspected. Maybe a rst "note" like this in the high-level web server docs: "Unlike the single-threaded HTTP servers common in Python before version 3.4, aiohttp's web server can be used in production deployments."

Or perhaps more detailed advice is needed? I know that Flask and Django have (very) popular modules or configurations where the WSGI app is configured to serve static files as well (e.g., Flask's serve_static and djstatic).

@ludovic-gasc
Copy link
Contributor

Hi @ariddell,

For your information, we've 15+ aiohttp daemons on production, with a lot traffic, we have really better performances than before with Flask and Django.
We use HAproxy on some architectures, to handle TLS and distribute charge between several aiohttp daemons.

[ad] If you're interested in performance with aiohttp, I've made a small tool to build daemons with aiohttp, and distribute charge between several processes.
You can see a quick'n'dirty benchmark here: https://github.com/Eyepea/API-Hour#quickndirty-http-benchmarks-on-a-kitchen-table
You can follow the tutorial: http://pythonhosted.org/api_hour/tutorials/all_in_one.html
Don't hesitate to contact me if you have a question. [/ad]

Regards.

@asvetlov
Copy link
Member

Unlike the single-threaded HTTP servers common in Python before version 3.4

Why not? Twisted and Tornado are very widespread. aiohttp just gives simpler API for end users.

aiohttp.web has support for static files, but it will be ready for production usage only after implementing sendfile in asyncio.

@ariddell
Copy link
Author

This is great! I'm only suggesting that some of this information be in the docs because users of Flask, Django, and Bottle (unlike users of Twisted and Tornado) will anticipate specific instructions on Deployment, as the default for those Frameworks is single-threaded.

@asvetlov
Copy link
Member

@ariddell as the issue initiator would you make a Pull Request with proposed documentation changes?

You know the best what you do like to see at result.

Ha, you are already done.

Thanks.

@fafhrd91
Copy link
Member

i added simple section how to start aiohttp.web app with gunicorn https://github.com/KeepSafe/aiohttp/blob/master/docs/gunicorn.rst

@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

Successfully merging a pull request may close this issue.

4 participants