azure-sdk-for-python icon indicating copy to clipboard operation
azure-sdk-for-python copied to clipboard

Configurable connection pool size in azure.storage package

Open bertek41 opened this issue 1 year ago • 4 comments

  • Package Name: azure-storage-blob, azure-identity
  • Package Version: 12.19.1 - 1.15.0
  • Operating System: Ubuntu
  • Python Version: 3.10.12

Describe the bug I've seen configurable pool_size in here https://github.com/Azure/azure-sdk-for-python/issues/12102 but I am using BlobServiceClient and this doesn't work for here.

To Reproduce Steps to reproduce the behavior: initialize with BlobServiceClient. Have a 10 threads. And simultaneously execute #get_blob_client#upload_blob

Errors:

WARNING:urllib3.connectionpool:Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f0f5be97a30>: Failed to establish a new connection: [Errno 111] Connection refused')': /session/**HIDDEN**/url
WARNING:urllib3.connectionpool:Connection pool is full, discarding connection: localhost. Connection pool size: 1

My BlobServiceClient

    BlobServiceClient(
        AZURE_ACCOUNT_URL,
        credential=ClientSecretCredential(
            client_id=os.getenv("AZURE_CLIENT_ID"),
            client_secret=os.getenv("AZURE_CLIENT_SECRET"),
            tenant_id=os.getenv("AZURE_TENANT_ID"),
        ),
    )

bertek41 avatar May 02 '24 11:05 bertek41

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @jalauzon-msft @vincenttran-msft.

github-actions[bot] avatar May 02 '24 11:05 github-actions[bot]

Hey @bertek41, how are you specifying your pooling configuration? I believe you should be able to supply your own transport to the BlobServiceClient as shown here.

pvaneck avatar May 03 '24 01:05 pvaneck

Hi @bertek41. Thank you for opening this issue and giving us the opportunity to assist. To help our team better understand your issue and the details of your scenario please provide a response to the question asked above or the information requested above. This will help us more accurately address your issue.

github-actions[bot] avatar May 03 '24 01:05 github-actions[bot]

Hey @bertek41, how are you specifying your pooling configuration? I believe you should be able to supply your own transport to the BlobServiceClient as shown here.

I tried the transport parameter, but no matter what I type, nothing changes. I even gave str to the transport parameter, it didn't give any warning, I don't think it worked.

bertek41 avatar May 03 '24 06:05 bertek41

Hi @bertek41 - The transport parameter accepts should take in a Transport object such RequestsTransport as shown here, rather than a string. For a list of other Transport classes supported, please refer to this documentation.

As @pvaneck mentioned, a snippet of code that shows how you are creating your client and specifying pooling configuration would allow us to better assist.

swathipil avatar May 06 '24 18:05 swathipil

Hi @bertek41. Thank you for opening this issue and giving us the opportunity to assist. To help our team better understand your issue and the details of your scenario please provide a response to the question asked above or the information requested above. This will help us more accurately address your issue.

github-actions[bot] avatar May 06 '24 18:05 github-actions[bot]

I figured out. If I use BlobServiceClient like this:

    BlobServiceClient(
        AZURE_ACCOUNT_URL,
        credential=ClientSecretCredential(
            client_id=os.getenv("AZURE_CLIENT_ID"),
            client_secret=os.getenv("AZURE_CLIENT_SECRET"),
            tenant_id=os.getenv("AZURE_TENANT_ID"),
        ),
        transport=...
    )

Nothing changes. But when I use like this:

BlobServiceClient.from_connection_string(AZURE_CONNECTION_STRING, transport=...)

Service does use transport.

bertek41 avatar May 08 '24 12:05 bertek41

Hi @bertek41. Thank you for opening this issue and giving us the opportunity to assist. We believe that this has been addressed. If you feel that further discussion is needed, please add a comment with the text "/unresolve" to remove the "issue-addressed" label and continue the conversation.

github-actions[bot] avatar May 16 '24 15:05 github-actions[bot]