CosmosCLient sample with connection pooling
Is your feature request related to a problem? Please describe. Looking for a cosmosdb sample to utilize connection pools couldn't find any at https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/cosmos/azure-cosmos/samples
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @southpolesteve, @zfoster
@annatisch Can someone familiar with core-http answer this question? Cosmos doesn't expose any knobs on HTTP connection pools AFAIK. We just use whatever defaults core-http provides.
Hi @prashanthmadi, @southpolesteve - sorry I somehow missed this. Let me take a look today.
Hi @prashanthmadi - you should be able to supply your own underlying Requests session to the client in order to handle connection pooling - as is documented in this issue here: https://github.com/Azure/azure-sdk-for-python/issues/12102#issuecomment-645641481
Let me know how this goes :) You're right in that we don't have a sample for this - but given that it is a feature universal to our (recent) SDKs, we would likely document/sample this feature in a common way, rather than write a specific sample for it for every SDK that supports it.
I noticed the Java and .net CosmosClient suggest using CosmosClient as a singleton to improve performance. Is the python CosmosClient threadsafe or is that what supplying a Requests session would allow (apologies I’m new to python).
My situation is I’m using the python CosmosClient in azure functions. I’m creating a new CosmosClient in each request and seeing metadata fetches for every invocation which is impacting performance.
Closing due to inactivity. Please reopen if this is still an issue.