I’m using concurrent.futures‘ class ThreadPoolExecutor to do stress testing on a webservice.
As far as I can understand, the max_workers constructor parameters tell the executor what’s the maximum number of threads that will be in the pool. Anyway, is there any guarantee that that’s the number that will be effectively used, or it could be lesser (for example, due to some hardware limitation) than that?
If so, is there a way to know how many worker threads will be effectively instantiated?
from the doc
from the code, _adjust_thread_count(), seems the new thread is created on demand and limited by max_workers.
also seems
len(self._threads)is for the effectively instantiated.