Reuse CloudBlobClient Object

This link categorically states that you should reuse the same client across requests because these clients manage connections and are thus capable of optimising the underlying calls to establish a connection with the service.

This is the direct link to Microsoft Documentation says the same

Cosmos Db advice is similar in that it recommends a singleton pattern for the lifetime of your application


Depends on the client version, I found an answer from someone at Microsoft here: https://github.com/Azure/azure-storage-net/issues/732#issuecomment-745749919

As for making CloudBlobClient singleton. One can attempt to do this with some success. However, please be mindful that V11 and prior types like CloudBlobClient and CloudBlob are stateful. They might have mutable properties and some APIs might mutate the state. Therefore I recommend caution while attempting this. I strongly recommend to move to V12, where all clients has been designed stateless and can be safely used with any lifespan.


You can reuse instances, just don't access the same instance from multiple threads concurrently because it is not thread safe.

UPDATE April 2019 (7yrs later)

NOTE: You should always consult the latest SDK documentation.

Yes, it is now (as of this update at least) safe to use CloudBlobClient and other objects in a thread safe manner in newer versions of the SDK. In fact, it is encouraged by some documentation that you find, but it is technically still not guaranteed to remain that way by design (e.g. future major versions of the SDK could reneg on this).

As usual, you should probably be providing an abstraction for your application level logic that hides the client and its lifetime as much as possible. Then you let the abstraction worry about lifetime management. Maybe that's using a simple static instance today, it's maybe using pooling tomorrow, but at least if there's a problem the majority of your application logic is abstracted from it. 👍


You can reuse it. To my knowledge, it contains no state whatsoever beyond what it's initialized with.