问题
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