In this link is an example of finding prime numbers posted here. In his code, he compared sequential, threading, thread executor and process executor to find prime numbers. In his code, he found that ProcessPoolExecutor
is the fastest:
Sequential Prime Finder Starting
9.708213827005238 seconds
Threading Prime Finder Starting
9.81836523200036 seconds
Processing Prime Finder Starting
3.2467174359990167 seconds
Thread Executor Prime Finder Starting
10.228896902000997 seconds
Process Executor Finder Starting
2.656402041000547 seconds
Question: Is it a good idea to have Process Executor (ProcessPoolExecutor
) to manage incoming requests? I see that using ProcessPoolExecutor
based on the example above could lead to low processing time but might decrease application throughput as I am not sure of the consequences of choosing to process requests using ProcessPoolExecutor
versus Threading
for example.