-
-
Notifications
You must be signed in to change notification settings - Fork 100
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
Dealing with long running client #320
Comments
AWS has docs about where to place it. It's usually outside of the Lambda handler function. It's usually the first search results. But I think what you're seeing might be the Lambda coldstart. |
yes, more or less. I've put my client init outside the handler. But seems like that, even so, the first call to SNS (that is my case) is taking forever (3.5 secs). Afterward, consecutive calls are taking 200 ms. Interestingly, I've tried to set up a CloudWatch event that is always warming the lambda function (more or less), with this trick I was able to decrease the timing to 1.2 secs on the first call, consecutive calls are still taking 200 ms. To reduce the time also for the first call I was forced to call the list topic right after the initialization of the Boto client |
This is cold start problem, right? After you deploy your AWS Lambda container? When you deploy a new version, it takes 3.5 to 5 seconds to cold start and fully answer a client? If it is, we deal with this problem via blue/green deployments with CodeDeploy. For us, we use the CDK, specifically
This way you can pre-warm the new version and only switch traffic to the new version after the cold start has been "dealt with". It has the benefit of testing all the way to a simple DB call so in case there's a failure the new version never gets switched in. |
thank you so much @nitsujri! it worked for me |
Hello, do you know which is the beast way to deal with a long-running client? I'd like to use boto3 client within an api call, but it is taking forever every time to setup the session and making the call. Any suggestion? where is the best place where to initialize the boto3 session?
The text was updated successfully, but these errors were encountered: