This repository is for active development of the Azure SDK for Python. For consumers of the SDK we recommend visiting our public developer docs at https://learn.microsoft.com/python/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-python.
Is your feature request related to a problem? Please describe.
I am using the Azure ML SDK inside an Azure Function. I've measured that reusing a (global) Azure ML SDK MLClient instance throughout the application is significantly faster, compared to instantiating a new client for every operation, even when reusing the Azure Identity credential. Since synchronous Azure Functions can be scaled via a thread pool, this means that the MLClient would be shared across multiple threads.
Is MLClient and its instance methods thread-safe and supports being reused throughout the application?
Is your feature request related to a problem? Please describe.
I am using the Azure ML SDK inside an Azure Function. I've measured that reusing a (global) Azure ML SDK
MLClient
instance throughout the application is significantly faster, compared to instantiating a new client for every operation, even when reusing the Azure Identity credential. Since synchronous Azure Functions can be scaled via a thread pool, this means that theMLClient
would be shared across multiple threads.Is
MLClient
and its instance methods thread-safe and supports being reused throughout the application?Other Azure SDKs, such as the Azure Blob Storage SDK or Azure Identity document whether their API is thread-safe or not.
Describe the solution you'd like
If the
MLClient
is safe to be shared across threads, it would be great to document it is. If it's not, it would be great to make it thread safe.Describe alternatives you've considered
Creating an
MLClient
on each request, or alternatively maintain our own pool ofMLClient
s.