Azure blob storage - automatically generates a unique blob name

I am writing a small web application for Windows Azure that should use blob storage to obviously store a drop.

Is there a function or way to automatically create a unique name for inserting a blob in a tab?

+6
source share
4 answers

You can use Guid for this:

string blobName = Guid.NewGuid().ToString(); 
+7
source

In addition to what Sandrino said (using a GUID with a very low probability of duplication), you can consider some third-party libraries that generate examples without conflict: Flake ID Generator

EDIT

Herve pointed out the very correct Azure Blob function, which should be considered with any blob names, namely, Azure Storage load balancing and blob sharing.

Azure retains all locks on partition servers. Which partition server should be used to store a specific blob is defined in the blob container and the blob file name. Unfortunately, I could not find the documentation describing the algorithm used to split blob.

For more information on Azure Blob architecture, see Windows Azure Architecture Architecture Overview .

+4
source

There is nothing that generates the unique name "on insert"; you need to come up with this name ahead of time.

When choosing the name of your blob, be careful when using any algorithm that generates a sequential number of any type (either at the beginning or at the end of the blob name). Azure Storage uses the name for load balancing; using sequential values ​​can lead to a conflict in access / write to Azure Blobs, as this may prevent Azure from properly balancing the load on its storage. You get 60 MB / s on each node (i.e. the server). Thus, in order to ensure the correct load balancing and use 60 MB / s on several storage nodes, you need to use random names for your blobs. I usually use Guids to avoid this problem, as Sandrino recommends.

+4
source

This is an old post, but it was the first hit that appeared to search on the "unique Azure Blob Storage Identifier".

It seems that the generated metadata_storage_path property is unique, but not filtered, so it can be useless for some purposes.

enter image description here

enter image description here

0
source

All Articles