-
Notifications
You must be signed in to change notification settings - Fork 312
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
[3.x] Pre-import cdk libraries at the beginning of cluster create and update #4778
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #4778 +/- ##
===========================================
+ Coverage 89.17% 89.19% +0.01%
===========================================
Files 163 164 +1
Lines 14369 14386 +17
===========================================
+ Hits 12814 12831 +17
Misses 1555 1555
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 questions:
- what happens if the main thread reaches the cdk import before the warm up thread has completed?can it break due to some race condition?
- what happens if I exit the cli with ctrl+c while the background thread is running? will it hang?what is present in logs?
That's exactly the case I have tested. It doesn't break, both threads continue in parallel and the import completes simultaneously in both. I ran this test several times and it never broke.
cli exits without hanging, logging:
|
72e64db
to
5d6bb6a
Compare
Import of cdk libraries at lambda cold start takes 12 to 16 seconds, sometimes causing lambda timeout. Importing them in a separate thread, started at the beginning of create and update operations and executed concurrently with stack validation allows to reduce the time to complete the operation.
5d6bb6a
to
b7cef99
Compare
Multiple concurrent cdk imports tested:
Output:
Same result with 1000 iterations and delay of 0.01 sec. |
Following code exited with ctrl+c without hanging:
|
Description of changes
Import of cdk libraries at lambda cold start takes 12 to 16 seconds, sometimes causing lambda timeout.
Importing them in a separate thread, started at the beginning of create and update operations and executed concurrently with stack validation allows to reduce the time to complete the operation.
The amount of the execution time gain depends on how long the validation takes.
Longer is the validation more impactful this optimization gets.
Tests
Manual test via API
Manual test via CLI
References
Checklist
Please review the guidelines for contributing and Pull Request Instructions.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.