Home > Software design >  Azure Blob - Create subfolder or create multiple containers
Azure Blob - Create subfolder or create multiple containers

Time:01-04

I am migrating some files stored in SQL Server to Azure Storage (Blobs), it's a legacy .NET Framework web application.

The "issue" is: I have multiple countries using this webapp (each one uses its own database instance), for example, let's say: USA, Canada and Mexico.

What would be a good approach to store these files in Azure Blob? I was thinking about creating a single container, for example, orders-container, and inside create a folder structure by country, like this:

orders-container > USA > report.pdf
orders-container > CAN > report1.pdf 
orders-container > MEX > report2.pdf

However, I'm kinda questioning myself about this approach when I think about performance and management. I don't know if it would be better to create like this or if I should create a container per country, for example:

orders-container-USA > report.pdf

and so on for the other countries.

I also think that maybe if someday I would have to move these files to somewhere else, it would be easier to move if they would have a container per country and not a single container for everyone.

Have anyone faced this kinda of design "issue" to think about?

Many thanks!

CodePudding user response:

Since you are using blob storage, you can use either option but the benefit of using separate containers for each country is that access can be segregated. If you use only 1 container, you cannot segregate access to the files within the container (unless you enable hierarchical namespace).

  • If you have no requirement of access segregation now or in the near future, then go with one container since it offers the ease of file movement and management.
  • If you need to segregate the access to each country's data in the blob, then I would suggest you go with separate containers per country.

If you enable hierarchical namespaces, then you can use a single container and you still have the flexibility of controlling access to each of the (physical) folders.

As @silent mentioned, there is no difference in performance with using a single or multiple containers.

  • Related