Basically, gevent and multiprocessing are for different use cases. If
your application needs to do heavy IO, with a large number of
concurrently-open sockets, gevent should work much better for you than
mutliprocessing. Greenlets are very lightweight, so you can have very
many of them active at once without any trouble.
On the other hand, if your program needs to do a lot of CPU-heavy work
in parallel, you'll probably want to use multiprocessing, because
greenlets can't run on multiple CPU cores.
Leif
> Hi Leif,
>
> Thanks for your answer. In case I had to do CPU-intensive computations, what do you think about putting gevent behind a reverse proxy, like Nginx with uWSGI? Could I take advantage of more than one core then? I am a total noob about this, and I don't know if this would help to improve the situation in that case.
You can put gevent on top of uWSGI without particular problems (you only need to load the greenlet plugin with --plugins greenlet).
Spawning multiple workers in uWSGI will allows you to have cpu concurrency too (remember to use processes and not threads, as they do not works in
async mode).
It is a fair new setup (in the past uWSGI supported only its personal implementation of green threads) so feel free to ask for help
in the uWSGI list or irc channel
--
Roberto De Ioris
http://unbit.it