Closed abhinavsp0730 closed 1 year ago
See here https://github.com/terrycain/aioboto3/issues/279, yeah I definitely wouldn't recommend creating a session repeatedly
@terrycain just wanna confirm, is it safe to do so? Are there any risk of getting the connection closed?
In theory as long as you do async with on .client or .resource, that should suffice
I am also trying to do the same thing. My idea is to build a session and client factory and use it. Keeping the session ok, but keeping the client I still don't know if it's a good practice. do you know?
I've kept clients open in the past, especially when dealing with multiregion stuff, it should be fine to do so but I'd do a bit of stress testing with that as the internals of aiobotocore have changed a fair bit since I've been that deep in the code
Description
I'm having a fastapi server where I upload file using aioboto3. But Surprisingly the time taking to create the
session
and initialing thesession client
is more than the the time to upload the file. I have used line profiler to profile the code.@terrycain is there any way I can move
session = aioboto3.Session()
in the startup of the web application. But I'm not able to move initialition of session.client to the startup of the web application.Thanks