Azure / azure-rest-api-specs

The source for REST API specifications for Microsoft Azure.
MIT License
2.62k stars 5.04k forks source link

Long Response Times When Listing SKUs #29633

Closed Remuwon closed 2 months ago

Remuwon commented 3 months ago

Describe the bug I am experiencing significant delays when attempting to list SKUs using the azure.mgmt.compute Python SDK. The request takes an unusually long time to return (20-30 seconds), impacting the performance of my application.

To Reproduce Steps to reproduce the behavior:

  1. Initialize the ComputeManagementClient with valid Azure credentials.
  2. Call the resource_skus.list() method.
  3. Observe the time taken for the method to return.

Sample Code:

from azure.identity import DefaultAzureCredential
from azure.mgmt.compute import ComputeManagementClient

# Initialize credentials and client
credential = DefaultAzureCredential()
subscription_id = 'your-subscription-id'
compute_client = ComputeManagementClient(credential, subscription_id)

# List SKUs
try:
    skus = compute_client.resource_skus.list()
    skus_list = list(skus)
    print(f"Total SKUs retrieved: {len(skus_list)}")
except Exception as e:
    print(f"An error occurred: {e}")

Expected behavior The SKUs should be listed promptly without significant delays.

Additional context

For some background, I need to show customers regions where specific vm family types exist so that they can launch their workloads in the correct region. As far as I've searched there is no specific api to do this. Leaving me with the compute SKU list api. I fetch the sku and create a reverse hash map mapping vm family to region.

github-actions[bot] commented 3 months ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @amjads1 @avirishuv @Drewm3 @vaibhav-agar.

kristapratico commented 3 months ago

@Remuwon thanks for your detailed issue, the team will take a look and get back to you as soon as possible.

ChenxiJiang333 commented 3 months ago

Hi @Remuwon, I guess it's because the amount of skus to retrieve is too large. Python sdk could not make any change on it, so I have to transfer this issue to service team to see whether there could be any optimizing for this api.

microsoft-github-policy-service[bot] commented 3 months ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @Drewm3, @TravisCragg-MSFT, @nikhilpatel909, @sandeepraichura, @hilaryw29, @GabstaMSFT, @ramankumarlive, @ushnaarshadkhan.

TravisCragg-MSFT commented 2 months ago

@Remuwon The response size of this query is ~2-4Mb of JSON, and can take some time to parse depending upon the application. At this time, there is no way to reduce this further.

We are in the process of revamping this API to allow for targeted queries with KQL, where you can write a query that will only return a list of regions that a SKU is supported. Keep an eye on upcoming announcements over the next year for more information.