-
Notifications
You must be signed in to change notification settings - Fork 421
Bug: High import time when importing ApiGatewayResolver
because of CodePipelineJobEvent
#2352
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
Comments
Thanks for opening your first issue here! We'll come back to you as soon as we can. |
I do not know if this is a really "bug". I am just want help with this problem. :) Thank you. |
Hi @darnley! Tudo bom? 😃 Thank you very much for opening this issue, I really appreciate it!! Actually, I consider this a bug because it affects performance and you could demonstrate this. The problem here is how things happen in Python and not exactly a bug generated because of a wrong code or something like this. Let me try to explain what is going on and a possible solution. We have the Event Source Data Class utility. This utility helps developers to transform the Lambda Payload into a dictionary-like object, what makes easy to access properties and nested items. The We are not directly importing the I think we can solve this problem by changing the boto3 import in CodePipelineJobEvent class. We just need to import I've made some changes in my local environment and check this: If you have bandwidth, please send a PR to fix this, if not, don't worry, I can fix it. We are planning to release a version this week and this issue makes it more urgent than I expected. Muito obrigado 🚀 |
Hello, @leandrodamascena! Tudo bem e com você? 😊 That sounds perfect and thanks for the explanation. I am sending a PR to fix this. |
|
Expected Behaviour
Do not import
CodePipelineJobEvent
when usingApiGatewayResolver
, because theCodePipelineJobEvent
will importboto3
and huge increase the AWS Lambda Cold Start or preventboto3
from being called unexpectedly.Current Behaviour
When importing
ApiGatewayResolver
, it is importingCodePipelineJobEvent
andboto3
. However,ApiGatewayResolver
does not needboto3
.This behaviour is increasing the AWS Lambda cold start. When I use a profiling tool in my machine, it seems that just to import it is costing ~200ms. When running on AWS with a 800MB runtime, it is costing ~400ms.
According to the profiling in this use case, importing
CodePipelineJobEvent
costed 61.9% of time, but it will not be used. That is weird.profile.log
Code snippet
Possible Solution
No response
Steps to Reproduce
tuna
package usingpip install tuna
;Browser will appear with the profiling graph.
Powertools for AWS Lambda (Python) version
latest
AWS Lambda function runtime
3.9
Packaging format used
PyPi
Debugging logs
No response
The text was updated successfully, but these errors were encountered: