How to control the timing of process initialization in Python process pool

一个人想着一个人 提交于 2021-01-29 20:05:10

问题


I used multiprocessing.Pool to imporove the performance of my Python server. But I found that, if I create a Pool with processes=100, when the server is started and the task has not yet started running, there will be 100+ processes while executing the command "pstree |grep python | wc -l".

Does that mean all the process will be initialized when the pool is initialized? Will it result in a waste of server resources? Is there a way to control the timing of process initialization in Python process pool.

Here's how I use the process pool:

self._driver_pool = Pool(processes=100)

来源:https://stackoverflow.com/questions/65698798/how-to-control-the-timing-of-process-initialization-in-python-process-pool

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