Azure.NET Component Lifetime (CloudQueueClient, CloudQueue, etc.)

If I add Windows Azure queue elements or blob storage links from an MVC application using the .NET SDK, how long should each component stay?

For queues, we have CloudStorageAccount , CloudQueueClient, and CloudQueue .

For storage of blocks we have CloudStorageAccount , CloudBlobClient and CloudBlobContainer .

I suppose it would be better to create each component once for a web request, but it really is not as important how expensive it is to create each element. Again, I assume that keeping clients between web requests using the same lifetime, for example, would not be a good plan, but there is nothing to do.

+5
source share
1 answer

Those .NET objects are lightweight. None of them will allocate resources or perform network operations only by creating them. You should usually not try to cache or merge them unless you create them quite a lot.

- . , , .

+6

All Articles