-
Notifications
You must be signed in to change notification settings - Fork 87
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
awscli takes very long to start #159
Comments
Hello @MartinLoeper sorry for not responding earlier. The first run duration could be building pyc files. I am only guessing since I am not one of the AWS CLI developers. Will try to get someone who can explain more deeply. |
Hi @rpcme, Thanks for offering help! |
@MartinLoeper Can we please ask more information - what are the timings for first run and second run by using We will then analyze and see what the next step should be such as reproducing. |
Subsequent runs yield:
Version:
|
Well that doesn't look like anything :( |
Hey @MartinLoeper, The Decreasing the overall cpu usage will decrease the difference between the |
Hello @MartinLoeper can you let me know your config. I'll try to find time to run it through strace to see if we're getting slowdown anywhere that way. You might try the same if convenient to locate any bad smells. Also can you let me know if the orange pi zero is the same spec as raspberry pi zero. I don't have the former but I do have the latter. |
Hi @rpcme, strace is a good idea. However, I already tried it and could not find anything wrong. I just noticed that many many files are opened due to python imports and boto3 loaders - particularly service model loaders. You further reminded me of our company also possessing a bunch of Raspberry Pis... |
Hi @MartinLoeper I'll just check back weekly to see when you're back from vacation. I'm looking forward to seeing progress. |
Hi @MartinLoeper just checking in to see if you have had a chance to repro? Would love to get this ticket closed :) |
Hi @rpcme, I'm back! Thanks for the mention. I ran the aws-cli on our raspberrypi 4b and got the following result:
Second run:
You can reproduce the yocto image with the kas manifest in the following repo: https://github.com/MartinLoeper/meta-aws-issue-159/ I enabled the serial port via UART to connect to the device. |
I can also share the fully built sdimg file with you if you want to. |
Martin, I am experiencing the same issue on a RISC-V board. I am not exactly sure what it is but I really don't know if it's a meta-aws problem. But it's definitely a problem. Really, it is horrible invoking the aws cli and waiting for seconds for it to even start. I did start invoking the API calls individually and it isn't the python interpreter that takes time, it is the CLI initializer code. I really don't know anything about python profiling so a bit at a loss. |
@MartinLoeper I am asking for help from experts maintaining meta-python. While I can't promise a fast solution, I just wanted to let you know I am looking for more avenues to help. |
Thanks @rpcme! This issue is currently not as urgent because I could try a workaround using SDKs I guess. Nonetheless, great you are so supportive! Really appreciating it! |
This is really great news @MartinLoeper. I will keep it open until resolved because ... well ... I want to use it on workstation class distribution on RISC-V - but can't exactly do that if it takes 4-8 seconds to invoke every command :D |
Understandable! Hope someone has a clue what is going wrong there. |
I have not forgotten this issue. The next step will be to file a YP bugzilla bug after narrowing the slow module load problem. After running cProfile I noted that module load times are excessive. When invoking python3 -X dev /usr/bin/aws and see the following output but I can't find any information related to _SixMetaPathImporter. root@qemux86-64:~# python3 -X dev /usr/bin/aws
<frozen importlib._bootstrap>:914: ImportWarning: _SixMetaPathImporter.find_spec() not found; falling back to find_module()
<frozen importlib._bootstrap>:914: ImportWarning: _SixMetaPathImporter.find_spec() not found; falling back to find_module()
<frozen importlib._bootstrap>:671: ImportWarning: _SixMetaPathImporter.exec_module() not found; falling back to load_module()
<frozen importlib._bootstrap>:914: ImportWarning: _SixMetaPathImporter.find_spec() not found; falling back to find_module()
<frozen importlib._bootstrap>:671: ImportWarning: _SixMetaPathImporter.exec_module() not found; falling back to load_module() |
I think it's a botocore problem, as mentioned here: boto/botocore#2553 |
I think that we can resolve this issue as wont-fix from a meta-aws perspective. |
I just installed the awscli using this layer's recipe and noticed that it performs very badly on the vexpress-qemu machine (1 cpu core) and the orange-pi-zero (quad-core Cortex-A7):
Subsequent executions are a bit faster but still perform consistently bad:
I figured out that most of the time is spent during importlib._bootstrap - particularly importing stuff like urllib3. This is also confirmed by observing
time python3 -c "import urllib3"
which yields:I noticed people also talking about python import resolution speed e.g. here. However, I am no python expert. Can someone tell me why awscli takes so long to start / initialize on my iot devices and only a fraction of the time when run on a single cpu core of my laptop?
The text was updated successfully, but these errors were encountered: