1

I heard a lot that Azure Web Applications uploaded content such as images or any files should be stored in Azure Storage service, not in the app File System. But I would like to keep the solution simple and store those files into local file system.

Does storing images or any files on the application's local file system hampers somehow the application deployment with more than one instance?

Daniel Santos
  • 14,328
  • 21
  • 91
  • 174

2 Answers2

2

By storing files on the Web application, you're limiting your ability to scale.

The web server/app should do one thing: process your request and output the HTML. Everything else should be handled elsewhere if you truly want to take advantage of cloud computing. So for this instance you should store any files off the web app.

Now if you want to keep this as simple as possible and you're not overly concerned with achieving scale, there's really nothing wrong with your approach. It's my understanding that Web Apps, don't actually spin up new virtual machines for you, or if they do, they replicate exactly what is on the VM. For instance think about this -- if you had all your files stored on one VM and you spun up two new ones, you'd have to copy all those files over to the next two, and now you'd have to create a way to sync all the uploaded files among all your VMs.

I don't actually think you'd run into this problem with Azure Web Apps, but it i a problem that can arise if you're handling the VMs yourself or through an auto-scaling policy. You'll definitely run into the issue if you decide to spin up new web apps in different regions (Say the Ireland region to your EU customers get better performance - you'd now have two different locations where files could be uploaded to and you'd need to sync them as opposed to uploading them to Azure storage all along and keepin them centrally located)

Jack Marchetti
  • 15,536
  • 14
  • 81
  • 117
2

After researching a lot, I understand that, unlike Amazon Beanstalk, all instances of a Web App share the same file storage. despite of ecah apps runs into a different VM, they file system is the same.

The best way to think about it is that all the instances of your app map to the same network drive share that have your files.

when you spin up 2 or more instances the files in the file are using that same storage based file system even if you only have one instance.

You can see that easily by dropping a file (e.g. via FTP), and seeing it reflected instantly in all instances.

Sources: Microsoft, This question and this question

Daniel Santos
  • 14,328
  • 21
  • 91
  • 174