-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Slow startup of AL2023 AMI #1751
Comments
@cartermckinnon suggested it might have something to do with EBS lazy block fetching resulting in slow startup for the executables we need: #1696 (comment) |
One way we can speed things up is to make sure that kubelet and containerd are loaded earlier in the chain.
|
We can test the EBS hypothesis by enabling fast-restore on the snapshot: https://docs.aws.amazon.com/ebs/latest/userguide/ebs-fast-snapshot-restore.html This is pretty expensive so I understand if you don't want to give it a try; but if you can update the PR description with your launch steps we can have consistency across our experiments @stijndehaes |
@cartermckinnon I am willing to give it a try. |
Here is the new result, with fast restore on the snapshot enabled.
|
@stijndehaes the output for from the initial log, it seems like amazon-eks-ami/nodeadm/internal/containerd/sandbox.go Lines 20 to 32 in f55411c
|
@dims Sorry it took so long to get back to you. I have restried with fast restore and got some better results. I takes around 50s with fast restore (still slower than the 40ish seconds I got with al2 without fast restore) and 100s without fast restore. So that appears to have an influence. Here are the logs of the services with and without fast restore: nodeadm-run with fast-restore |
Thanks for testing this out, my findings concur. I'll see what I can do! |
@cartermckinnon thank you very much, if I can help with anything please reach out :) At the moment I have a good flow of testing things out ;) |
Just retried it, the result are still similar. The biggest issue appears to be the call to get the version of kubelet, if we could get the version another way I think that would help a lot.
I will run a try out to see if this helps |
@stijndehaes you mean ( guessing from https://github.com/awslabs/amazon-eks-ami/blob/main/nodeadm/internal/kubelet/version.go#L18 ) |
@dims correct! That is the reason for the big timeout between these 2 log lines:
|
I did the following experiment. I change the
And changed the systemd config to the following:
Obviously the hard coded KUBELET_VERSION needs to be changed. This resulted in the following (result from systemd-analyze) The nodeadm-config.service went from 21s to 5.12s shaving of around 15s in the hot startup path: Do you guys think it makes sense to include this optimisation? Obviously we still need to fill in the correct kubelet version. And sadly it is still slower than the AL2 AMI |
@stijndehaes looking at the graphs for al2023 above, what happens if you disable the update-motd.service? (the before picture shows significant contribution from that one) |
@stijndehaes another one, what happens if you switch the order of getting kubelet version first (caching it) and THEN configuring the kubelet service? |
Just disable update-motd.service results in: So actually a great improvement! |
I am not exactly sure if I understand what you mean by this. Can you eleborate? |
@stijndehaes so please do file a PR for disabling the motd and let the team review it. on the other one, i was thinking of something like this diff where:
|
@dims made a PR for disabling motd. #1910 As to your suggestion to cache the kubelet version the biggest issue is that we are still using the kubelet executable and that needs to be fetched when that part of the EBS is not initialised yet. So it will still be slow. That was the reason for my suggestion with the Environment variable set during build. There is no dependency anymore on the kubelet executable. |
@cartermckinnon I see you have been hard at work at improving the boot times! Thanks for the hard work, as soon as an AMI is available with your improvements I will start testing :) |
Would be quite interested to see if the same work can be done for the GPU nodes as well, the nvidia components add quite a bit of boot time on AL2 at least. |
@sidewinder12s I'd love to speed things up on the AL2 GPU variant, but that's a different quest. When the transition to NVIDIA's open source kmod is complete, things will get much better. |
I'm going to close this out for now, as we've addressed the main items brought up in this thread. AL2023 nodes should have time-to-ready that is comparable to AL2 nodes. @stijndehaes let me know if your tests indicate otherwise! |
Oh mainly meant you might be able to get some of the same improvements on the AL or AL2023 GPU AMIs, but I was only able to look at the AL2 GPU AMI currently. Was mainly thinking adding the nvidia binaries to the initialize script that are in critical path might be an easy win. |
After trying the AL2023 AMI I noticed startup is way slower compared to the AL2 image.
After some help from @ndbaker1 I made the following analysis using
systemd-analyze
.I added a plot using
systemd-analyze
, the nodeadm component appears to be in the hoth path.With
nodeadm-config.service
taking 20s before it allowscloud-init.service
(7.2s) to start, and thennodeadm-run.service
takes 10.53s, I think it is waiting for containerd-service (8.7s) to start though.Looking at the logs of nodeadm-config, it appears to take a long time to start before the first log(5s), but also takes 13s between starting to configure kubelet and getting the kubelet version.
Looking at the logs of nodeadm-run, most time apears to be spend looking up the sandbox image. I noticed in code this is done using
containerd config dump
and a regex, for some reason this takes a long time.Not sure what can be done to optimize these steps, but I am willing to help :) I can write golang code and make custom AMI's with custom
nodeadm
if needed to test things out.nodeadm-config logs, via
journalctl -u nodeadm-config
nodeadm-run logs, via
journalctl -u nodeadmrun
:Originally posted by @stijndehaes in #1696 (comment)
The text was updated successfully, but these errors were encountered: