Multiprocessing vs gevent

百般思念 提交于 2019-12-12 11:35:34

问题


Currently I am using zeromq with pub-sub pattern, I have single worker to publish and many(8) subscriber (all will subscribe) to same pattern.

Now I tried multiprocessing to spawn subscribers it works. I am missing few messages.

Why I am using multiprocessing is to handle each message as it arrives and process them, every second publisher publishes 10 - 100 messages.

In this case it is advised use multiprocessing or gevent ?


回答1:


Multiprocessing will clearly have much higher memory overhead but will utilize another core (and you don't have to worry about lack of pre-emption) so.. it depends on your needs. It's likely that multiple processes using gevent will get you the highest throughput / lowest latency.




回答2:


I am answering my own question

I choose multiprocessing over gevent

  1. Server had 8 cores
  2. Parallelism was needed
  3. Choose ZMQ over multiprocessing queue or gevent queue.


来源:https://stackoverflow.com/questions/9994566/multiprocessing-vs-gevent

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!