If I am adding Windows Azure queue items or blob storage references from an MVC application using the .NET SDK, how long should each component stay about?
For queues we have CloudStorageAccount, CloudQueueClient and CloudQueue.
For blob storage, we have CloudStorageAccount, CloudBlobClient and CloudBlobContainer.
I am assuming that it would be best to create each component once per web request but don't really now how expensive it is to create each item. Again I am assuming that keeping the clients around between web requests using a singleton lifetime for example would not be a good plan but have nothing to go on.
Provides a client-side logical representation of the Microsoft Azure Queue service. This client is used to configure and execute requests against the Queue service.
Create the Queue Storage client Parse( CloudConfigurationManager. GetSetting("StorageConnectionString")); // Create the queue client CloudQueueClient queueClient = storageAccount. CreateCloudQueueClient(); Now you are ready to write code that reads data from and writes data to Queue Storage.
To delete the message, you must have two items of data returned in the response body of the Get Messages operation: The message ID, an opaque GUID value that identifies the message in the queue. A valid pop receipt, an opaque value that indicates that the message has been retrieved.
Append blobs are ideal for scenarios such as logging data from virtual machines. Page blobs store random access files up to 8 TiB in size.
Those .NET objects are lightweight. None of them will allocate resources or perform network operations just by being created. It's generally not worth the effort to cache or pool them unless you create quite a lot of them.
We don't even bother to cache them on a per-requests basis - we just create them as needed and throw them away. Caching them may save you some pressure on the garbage collector, but I doubt it would be much.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With