azure-cli: WSL: Why Azure CLI is too slow at each command execution?
Describe the bug It’s not exactly a bug but every command at PowerShell or Bash in WSL is too slow, I know that every command is making a web-api request call but is really sad this api call is causing too much delay.
I don’t know if I am at Brazil and the all api calls is from US and those internet latence is the cause but is really bad.
To Reproduce
Stay at Brazil and call a single command like az acr list
.
Expected behavior I don’t know, but some loading indicator or proxy all api request call near Brazil…
Environment summary Windows 10 with PowerShell and WSL
λ az --version
azure-cli (2.0.46)
acr (2.1.5)
acs (2.3.4)
advisor (0.6.0)
ams (0.2.3)
appservice (0.2.4)
backup (1.2.1)
batch (3.4.0)
batchai (0.4.3)
billing (0.2.0)
botservice (0.1.1)
cdn (0.1.1)
cloud (2.1.0)
cognitiveservices (0.2.3)
command-modules-nspkg (2.0.2)
configure (2.0.18)
consumption (0.4.0)
container (0.3.4)
core (2.0.46)
cosmosdb (0.2.1)
dla (0.2.3)
dls (0.1.3)
dms (0.1.1)
eventgrid (0.2.0)
eventhubs (0.2.4)
extension (0.2.1)
feedback (2.1.4)
find (0.2.12)
interactive (0.3.30)
iot (0.3.2)
iotcentral (0.1.2)
keyvault (2.2.3)
lab (0.1.1)
maps (0.3.2)
monitor (0.2.3)
network (2.2.5)
nspkg (3.0.3)
policyinsights (0.1.0)
profile (2.1.1)
rdbms (0.3.2)
redis (0.3.2)
relay (0.1.2)
reservations (0.4.0)
resource (2.1.4)
role (2.1.5)
search (0.1.1)
servicebus (0.2.3)
servicefabric (0.1.3)
signalr (1.0.0)
sql (2.1.4)
storage (2.2.2)
telemetry (1.0.0)
vm (2.2.3)
Python location 'C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\python.exe'
Extensions directory 'C:\Users\alexs\.azure\cliextensions'
Python (Windows) 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 16:07:46) [MSC v.1900 32 bit (Intel)]
Legal docs and information: aka.ms/AzureCliLegal
Additional context Every was slow here at Brazil, I don’t know if it is slow in another region, I’m posting it right now because I’m starting use Azure CLI constantly and I wish a better user experience.
Thank’s!
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 10
- Comments: 51 (14 by maintainers)
With the introduction of Command Index (#13294) and migration to PEP 420 (#14372), the client-side execution speed of Azure CLI has been significantly improved. That’s why we closed this issue.
If the Azure CLI command involves Azure REST API invocation, Azure CLI will spend most of its time communicating with Azure REST API and do long-running operation query, which is out of our control. In such case, those changes won’t give you too much performance improvement.
Please share the command as @yonzhan asked. Thanks.
I’ve been digging into az-cli performance and submitted a few fixes here and there. You may find a few more hints by running
--debug
to see where time is spent.Ideally
az
would do a much better job at optimizing its installation and extensions.See:
the following pipeline task took 1 minute and 47 seconds!!!
why on earth does that take so long to run???
I don’t think this is a WSL issue, I think this is an
az
CLI issue. I am observing differences in performance when comparing az CLI to PowerShell AZ. Why would az CLI commands run slower than PowerShell AZ?My script and an example observation below. Note that I am in New Zealand connecting to Australia East. I expect some latency, but I don’t expect difference in performance between CLI and PowerShell. The interesting result for me is the difference between
az group show
(2,931 ms) andGet-AzResourceGroup
(741 ms).DanielLarsenNZ/examples/blob/master/Scripts/Utilities/az-cli-vs-ps.ps1
It does not seems to be a geographical issue, but rather Azure slow responding. Which does not really not surprise me as also from the portal I often experience very slow operations.
Any comments from MS Azure people?
If anything this is worse than ever with 2.45.0:
time az --version real 0m1.039s user 0m0.328s sys 0m0.060s
time kubect get nodes real 0m5.654s user 0m0.086s sys 0m0.026s
Asking what version of the az CLI already takes more than 2 seconds. Isn’t that quite long for showing a version number?
I installed the CLI via the .msi installer.
@tjprescott Experiencing the same issue. A login request takes about 5 sec…
@tjprescott I am running Mac OSX and experiencing slowness as well.
@tjprescott It’s not only in WSL, PowerShell or CMD has same behavior.
There are performance issues native to WSL and Windows Defender that make things abnormally slow in this environment. Future versions of WSL aim to address this performance issue, but it is not something we control within the CLI.