Pirates Use Flask, the Navy Uses Django
wakatime.com
wakatime.com
1. How many application servers are you using?
2. How much RAM, CPU cores, etc. does each application server have?
3. How many database servers?
4. Which web server are you using?
5. Which WSGI server are you using?
6. What are the configuration settings for your WSGI server (mainly the ones related to number of processes, threads, etc.)
My motivation for asking was to get a sense of what it takes to serve higher traffic from a Flask API. I've yet to find a good resource that mentions what sort of web server/WSGI configuration is needed to serve high load applications that use Flask. Obviously, proper load testing is needed to really determine a reasonable setup, but I think having something ballparked from an actual production deployment could be helpful.
1
> 2. How much RAM, CPU cores, etc. does each application server have?
Using an m3.large ec2 instance so 2 vCPUs and 7.5 GiB ram (https://aws.amazon.com/ec2/instance-types/#m3)
> 3. How many database servers?
1 m3.xlarge ec2 instance running PostgreSQL with 4 vCPUs and 15GiB ram. Make sure you tune Postgres because defaults won't use all the resources available.
> 4. Which web server are you using?
nginx (http://nginx.com/)
My main config: https://gist.github.com/alanhamlett/09c95d1be18aa50dd3fb
My site config: https://gist.github.com/alanhamlett/712ff3d39131f7fdbba2
> 5. Which WSGI server are you using?
uWSGI (https://uwsgi-docs.readthedocs.org/en/latest/)
> 6. What are the configuration settings for your WSGI server (mainly the ones related to number of processes, threads, etc.)
My uWSGI site ini file (at /etc/uwsgi/enabled/wakatime.ini): https://gist.github.com/alanhamlett/f495a240de3013300563
My uWSGI main init file (at /etc/init/uwsgi.conf): https://gist.github.com/alanhamlett/e57b6b6fdaf3124fe29d
I'm pretty sure Reddit is running Pylons.[1][2]
That being said, I really wish Pyramid[1] (formerly repoze.bfg) would get a little bit more recognition in the Python web community. I particularly like Pyramid for its supports for Python 3 (even 3.2, which means it works well with PyPy3), good documentation (although sometimes a bit overwhelming) and the fact that the framework grow very well along with the app size. You can swap out or extend nearly everything in Pyramid, from renderers (Mako, Jinja, anything) to session object down to request objects, and may be even more.
It's true that these features are not unique to Pyramid and dependency with Zope components scare people off, but after few years of using several frameworks (started with web.py, then Django, Pylons, Werkzeug although not exactly a framework, Flask, etc.) I've found Pyramid to have the right balance between extensibility and simplicity. It could be a single file simple application if you want, or a big guy framework with authentication policy built-in if you ever needed one.
Interestingly, I got a tie between Flask and Django in the worksheet.
[1]: http://www.pylonsproject.org/projects/pylons-framework/about
[2]: https://github.com/reddit/reddit/search?utf8=✓&q=pylons
That said, after using Django for the better part of a decade, I'm all about Flask.
If using Flask, check out Alembic[1] for SQLAlchemy schema migrations.