Open ghstahl opened 4 years ago
hi @fengzhou-msft could you pls have a look? thanks
I changed my initial requirement. az cli must install under 4 seconds.
Terraform installed in under 4s via a github action and that was with a wget in the mix.
Terraform makes API calls to azure, as does az cli. A 5 min install is not an acceptable time compared to this direct competitor.
Install Terraform 4s
200K .......... .......... .......... .......... .......... 1% 88.9M 2s
Run pushd './'
~/work/terraform-setup-azfunc-shorturl/terraform-setup-azfunc-shorturl ~/work/terraform-setup-azfunc-shorturl/terraform-setup-azfunc-shorturl
Reading package lists...
Building dependency tree...
@ghstahl Azure CLI relies on a bunch of SDK dependencies and third-party packages. The MSI package size is over 50 MB and the space on disk after installation is over 200 MB.
With the current design, it's hard to make dramatic improvement. We are working on a lightweight installer to improve the install time.
@fengzhou-msft I was in a situation like this once where I had to change the design a bit so that I could zip the whole 100+ MB and slam it down to a folder. That was the install portion - unzip and run. Other than that, a rewrite in GO like terraform cli where its one big ole exe is the extreme option. Thank you for looking at this.
Setting up this as a 50 MB zip package on a CDN within Azure would be reachable right? Then you could stream the unzip command from this CDN location towards the disk of the agent. Or maybe preinstalling Az CLI on your shared agents. PowerShell Az Modules are already there with various versions. Or, @ghstahl you could set up your self-hosted agent with Az CLI preinstalled.
Investigating options for having less files would probably be the most fruitful exercise. There is overhead for each file no matter how large it is. Especially on windows. 200mb can copy extremely fast. You can see this if you have 2 local drives. Copy the CLI from one to the other. Then copy one 200mb file. Measure the difference and that's your opportunity for improvement for something with 200mb size on disk.
Beyond that. There may be some low hanging fruit in the msi. Compare the install time after downloading to the copy time you measured above to see what the msi overhead is.
Here is a small change that will help a little. https://github.com/Azure/azure-cli/pull/16903
I will note that upgrade is the worst path here. I have some ideas that could improve that path more too.
@jiasli for awareness
Something failed WRT to the PR title but nothing telling me what it should look like. Let me know what needs to be adjusted.
I did some tests recently:
On Windows 11 running on my Surface Book and Windows 10 running on my desktop PC, Azure CLI MSI (https://azcliprod.blob.core.windows.net/msi/azure-cli-2.34.1.msi) takes around 1m15s to install.
On Ubuntu 20.04 running in WSL, Azure CLI DEB (https://packages.microsoft.com/repos/azure-cli/pool/main/a/azure-cli/azure-cli_2.34.1-1~focal_all.deb) takes around 30s to install.
For MacOS, I don’t have a MacOS physical device at hand right now, but according to a test I made with Azure DevOps MacOS 1.15 agent, it take 2m30s: https://dev.azure.com/azure-sdk/playground/_releaseProgress?_a=release-environment-logs&releaseId=980&environmentId=1052
2022-03-10T08:47:46.9799610Z brew install azure-cli –verbose
2022-03-10T08:50:17.9113860Z az --version
The installation time is mainly due to the file number of Python SDK which includes lots of "duplicated" files for all API versions.
The overall file number of Azure CLI 2.34.1 is 15667 and 8594 files are from Python SDK (more than a half of totally file number).
Reducing Python SDK size (https://github.com/Azure/azure-sdk-for-python/issues/11149) will certainly improve the installation time of Azure CLI.
Do we have any update on this? It takes more than 800s to install azure cli in Github Runner
Microsoft owns dotnet that is able to build awesome CLI tools and could help to reduce the size of the executable as well as produce a self-contained app:
Other options could be Go or Powershell. Python was a weird choice for this tool. It makes it even weirder when different teams within Azure build tools using their own stacks, e.g. https://github.com/Azure/static-web-apps-cli/ It makes us, the end users, to download a bunch of dependencies that we did not sign up for.
Just installed the latest release on a powerful windows 11 workstation and it takes FOREVER. It's still running. I don't understand how I can install office or solidworks faster than a CLI. This install time really needs to be improved when it updates frequently.
Is your feature request related to a problem? Please describe. It isn't reasonable in some cases to prebuild VM images with az cli installed. In those cases, when its needed an install must be on par if not better than installing terraform.
I have a github action that has these numbers;
This is just the install as I had the installer checked in to my github repo.
Describe the solution you'd like A az cli install must be in the seconds range. (10-30 seconds). Frankly this should be a fast as a file copy.