3 ms·
Interested in knowing what backend setup you have that allows you to scale up to 27,000+ while using Flask: 1. How many application servers are you using? 2.
by dgilland 12y ago
Interested in knowing what backend setup you have that allows you to scale up to 27,000+ while using Flask:
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.
- deleted 12y ago[deleted]
- welder 12y ago> 1. How many application servers are you using? 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 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/ http://nginx.com/) My main config: https://gist.github.com/alanhamlett/09c95d1be18aa50dd3fb https://gist.github.com/alanhamlett/09c95d1be18aa50dd3fb My site config: https://gist.github.com/alanhamlett/712ff3d39131f7fdbba2 https://gist.github.com/alanhamlett/712ff3d39131f7fdbba2 > 5. Which WSGI server are you using? uWSGI (https://uwsgi-docs.readthedocs.org/en/latest/ 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 https://gist.github.com/alanhamlett/f495a240de3013300563 My uWSGI main init file (at /etc/init/uwsgi.conf): https://gist.github.com/alanhamlett/e57b6b6fdaf3124fe29d https://gist.github.com/alanhamlett/e57b6b6fdaf3124fe29d