R
R
Runcorn2014-02-01 03:40:43
Flask
Runcorn, 2014-02-01 03:40:43

How can I run a Flask application with a gevent WSGI server and still use all the CPU cores?

How can I run a Flask application with a gevent WSGI server and still use all the CPU cores? There is such an option: run several copies of the application, in which a separate port in a certain range is listening. For example, for 4 cores, we launch 4 processes and listen to ports in the range 5000..5003. We put nginx in front as a load balancer. But I'm not sure if this is the best option and maybe there are better ones?

Also, in your experience, what other WSGI servers would you recommend for a Flask deployment? gevent was chosen because it uses lightweight streams and the event loop is implemented with libev, so you can process client requests efficiently and quickly.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Y
Yuri Shikanov, 2014-02-01
@dizballanze

Try gunicorn it supports gevent workers.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question