You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In high-concurrency scenarios, frequently creating and destroying TCP connections can have a performance impact. Especially when using HTTPS, a TLS handshake must also be performed. Therefore, I hope to find a way to reuse the underlying TCP connections, and this method must be concurrency-safe.
This means that every time a file is uploaded, a client needs to be created through the context manager, and the client is automatically destroyed when the context ends. The underlying http_session of the client is responsible for maintaining TCP connections, and when the client context is exited, these connections are also destroyed.
If I keep the client's context until the program is closed. As shown below:
what are you wrapping a client around another effective context manager, it's already a context manager, just use it as is.
Yes clients are concurrency safe, that's how they're supposed to be used. A client instance maps to an aiohttp session, which contains a pool of connections which you can control via botocore Config max_pool_connections
In high-concurrency scenarios, frequently creating and destroying TCP connections can have a performance impact. Especially when using HTTPS, a TLS handshake must also be performed. Therefore, I hope to find a way to reuse the underlying TCP connections, and this method must be concurrency-safe.
In the current usage method:
This means that every time a file is uploaded, a
client
needs to be created through the context manager, and theclient
is automatically destroyed when the context ends. The underlyinghttp_session
of the client is responsible for maintaining TCP connections, and when the client context is exited, these connections are also destroyed.If I keep the client's context until the program is closed. As shown below:
My concern is whether the client object is concurrency-safe. At least I think that the
AIOHTTPSession
in the source code is not coroutine-safe.The text was updated successfully, but these errors were encountered: