-
Notifications
You must be signed in to change notification settings - Fork 154
Maintenance: initialize AWS SDK client only when needed to improve performance in Parameters #1740
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. |
Hi @marcioemiranda, thank you for opening this issue. You are right, the portion of the code that you highlighted could be refactored to create the client only when strictly needed. I'll put this item on the backlog and mark it as open for contributions. On a side note, we are currently working on supporting ES Modules and will release support in the coming weeks. Once that's released you will be able to use top-level |
@dreamorosi this is excelent news, will have big impact in performance |
|
This is now released under v1.14.1 version! |
Summary
Hello,
I am currently doing some performance tuning in our lambda functions and i notice that getting SSM parameters introduce some latency in the first execution. I've executed tests using both the getParameter utility and also SSMProvider. These were my findings:
ssm client instantiation: ~50ms
ssm provider instantiation: ~50ms
getParameter: 380ms (discounting 300ms from SDK, ~80ms)
SSM SDK get parameter: 300ms
In my tests I've used lambda functions configured with provisioned concurrency, so I tried to bring some of the latency to the INIT phase. I understand the best way to do it would be to:
However, I haven't noticed any gain of doing that. By inspecting the code bellow, I've noticed that SSM client is instantiated even when it's not used, i.e., when one passes the client as parameter. I believe this section could be optimized so that SSM client is only instantiated if none is available:
Why is this needed?
Improve performance of first execution when SSMProvider has a SSM client.
Which area does this relate to?
Parameters
Solution
Instantiate SSM client only when none is available
Acknowledgment
Future readers
Please react with 👍 and your use case to help us understand customer demand.
The text was updated successfully, but these errors were encountered: