-
-
Notifications
You must be signed in to change notification settings - Fork 30.3k
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
gh-81536: For nonblocking sockets, add SSLSocket.eager_recv
to call SSL_read
in a loop
#31492
base: main
Are you sure you want to change the base?
Conversation
Added the documentation. |
SSLSocket.eager_recv
to call SSL_read
in a loopSSLSocket.eager_recv
to call SSL_read
in a loop
@hashbrowncipher could you please re-sign the CLA using the button in this PR? |
Something weird looks like it happened with their original PR ( #81536 ), which makes the user appear deleted. So maybe there is a GitHub issue going on? |
7bb1705
to
507742c
Compare
@vstinner You have made many revisions to the |
I'm not available to review this change. |
c88d58b
to
5938d5f
Compare
@tiran a few more months passed, hoping you have some time to review this PR? |
Continue looping until data is exhausted, and only then reacquire the GIL. This makes it possible to perform multi-threaded TLS downloads without saturating the GIL. On a test workload performing HTTPS download with 32 threads pinned to 16 cores, this produces a 4x speedup. before after wall clock time (s) : 29.637 7.116 user time (s) : 8.793 12.584 system time (s) : 105.118 30.010 voluntary switches : 1,653,065 248,484 speed (MB/s) : 4733 19712 Original author: Josh Snyder - hashbrowncipher
5938d5f
to
f488960
Compare
✅ Deploy Preview for python-cpython-preview ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
This PR is a continuation of #25478, that was no longer updated by the author @hashbrowncipher.
I implemented all the requested changes.
However, the optimization changes behavior of an
SSLSocket.recv
. Therefore I introduced a parameter to enable this new behavior only when desired.The change in behavior if we don't add an opt-in:
It was requested in the review to also implement this for
write()
, however, that is not needed as OpenSSL'sSSL_write_ex
already writes the whole buffer at once. Only reading OpenSSL does in the 16k segments.Original PR-text:
Closes #25478.
Closes #81536
https://bugs.python.org/issue37355