-
-
Notifications
You must be signed in to change notification settings - Fork 32.8k
bpo-35279: reduce default max_workers of ThreadPoolExecutor #13618
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
45f1f43
to
d0d2ea3
Compare
d0d2ea3
to
4e7b131
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Doc/library/concurrent.futures.rst
Outdated
@@ -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 worker for I/O bound task. It utilize |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a native English speaker but I think it should be "It utilizes" and "And it avoids" in the next sentence.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, at least 5 workers
. And I'm not sure if it should be for I/O bound tasks
or 'for the I/O bound task`.
Doc/library/concurrent.futures.rst
Outdated
.. versionchanged:: 3.8 | ||
Default value of *max_workers* is changed to ``min(32, os.cpu_count() + 4)``. | ||
This default value preserves at least 5 worker for I/O bound task. It utilize | ||
at most 32 CPU cores for CPU bound task which release GIL. And it avoid using |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for CPU bound tasks
and which release the GIL
.
Doc/library/concurrent.futures.rst
Outdated
Default value of *max_workers* is changed to ``min(32, os.cpu_count() + 4)``. | ||
This default value preserves at least 5 worker for I/O bound task. It utilize | ||
at most 32 CPU cores for CPU bound task which release GIL. And it avoid using | ||
very large resource implicitly on many core machines. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/resource/resources
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is the corresponding change in the code? For reusing the idle worker threads before starting max_workers worker threads?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://bugs.python.org/issue35279