Azure / azure-cli

Azure Command-Line Interface
MIT License
3.94k stars 2.92k forks source link

Performance regression with latest `setuptools` #23177

Open jiasli opened 2 years ago

jiasli commented 2 years ago

It seems with setuptools 62.6.0 installed, disutils imports setuptools and pkg_resources. This causes some performance regression:

& "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\python.exe" -m pip list
setuptools             62.6.0

& "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\python.exe" -X importtime -m azure.cli version 2>perf.log; python -m tuna .\perf.log

image

Originally posted by @jiasli in https://github.com/Azure/azure-cli/issues/7447#issuecomment-1181600870

jiasli commented 2 years ago

When packaging an MSI

https://github.com/Azure/azure-cli/blob/99c5fb4cd661ecf157ce2b42cba26c681702305e/requirements.txt#L2

is not honored, so the latest setuptools is installed.

mkrzywanski commented 2 years ago

The new version of cli is completly unusable for me because of this regression. When can we expect this to be fixed? Is the only workaround now to downgrade the azcli?

jiasli commented 2 years ago

@mkrzywanski,

The new version of cli is completly unusable for me because of this regression.

How do you define "unusable"?

The latest 2.38.0 Azure CLI still only takes acceptable time (~900ms) to execute. This is still must faster than years ago (~2.3s).

> Measure-Command {az version}

Days              : 0
Hours             : 0
Minutes           : 0
Seconds           : 0
Milliseconds      : 911
Ticks             : 9115245
TotalDays         : 1.05500520833333E-05
TotalHours        : 0.00025320125
TotalMinutes      : 0.015192075
TotalSeconds      : 0.9115245
TotalMilliseconds : 911.5245
mkrzywanski commented 2 years ago

I have already downgraded to previous version that I used (2.31.0) so cannot check but with 2.37.0 and 2.38.0 it took like 5 seconds for me to get a simple secret value from keyvault. Also refreshing state with terraform took like 3 minutes for new azcli versions and with older versions it is blazingly fast.

jiasli commented 2 years ago

it took like 5 seconds for me to get a simple secret value from keyvault.

Could you share the command you used? We can help verify. @evelyn-ys

refreshing state with terraform took like 3 minutes for new azcli versions and with older versions it is blazingly fast.

You way report this issue to https://github.com/hashicorp/terraform-provider-azurerm instead.