bpo-35279: reduce default max_workers of ThreadPoolExecutor (GH-13618)

This commit is contained in:
Inada Naoki 2019-05-28 21:02:52 +09:00 committed by GitHub
parent 293e9f86b8
commit 9a7e5b1b42
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 22 additions and 5 deletions

View file

@ -159,6 +159,15 @@ And::
.. versionchanged:: 3.7
Added the *initializer* and *initargs* arguments.
.. versionchanged:: 3.8
Default value of *max_workers* is changed to ``min(32, os.cpu_count() + 4)``.
This default value preserves at least 5 workers for I/O bound tasks.
It utilizes at most 32 CPU cores for CPU bound tasks which release the GIL.
And it avoids using very large resources implicitly on many-core machines.
ThreadPoolExecutor now reuses idle worker threads before starting
*max_workers* worker threads too.
.. _threadpoolexecutor-example: