Skip to content
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

[PR #6274/254d0e7d backport][3.8] Clarify tiny timeouts behavior and how it can affect performance #6303

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES/6274.doc.rst
@@ -0,0 +1 @@
Added an explanation of how tiny timeouts affect performance to the client reference document.
25 changes: 25 additions & 0 deletions docs/client_reference.rst
Expand Up @@ -1710,6 +1710,31 @@ ClientTimeout

.. versionadded:: 3.3


.. note::

Timeouts larger than 5 seconds are rounded for scheduling on the next
second boundary (an absolute time where microseconds part is zero) for the
sake of performance.

E.g., assume a timeout is ``10``, absolute time when timeout should expire
is ``loop.time() + 5``, and it points to ``12345.67 + 10`` which is equal
to ``12355.67``.

The absolute time for the timeout cancellation is ``12356``.

It leads to grouping all close scheduled timeout expirations to exactly
the same time to reduce amount of loop wakeups.

.. versionchanged:: 3.7

Rounding to the next seconds boundary is disabled for timeouts smaller
than 5 seconds for the sake of easy debugging.

In turn, tiny timeouts can lead to significant performance degradation
on production environment.


ETag
^^^^

Expand Down
1 change: 1 addition & 0 deletions docs/spelling_wordlist.txt
Expand Up @@ -159,6 +159,7 @@ env
environ
eof
epoll
expirations
etag
facto
fallback
Expand Down