Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In Azure, Where should I store physical files that need to be accessed by a Worker Role?

In Azure, Where should I store physical files that need to be accessed by a Worker Role?

In my case I would normally store these particular files in my Web Role's App_Data folder but I don't believe that Worker Roles can access that folder.

like image 860
David P Avatar asked Apr 16 '12 10:04

David P


3 Answers

If you place your files in Windows Azure Storage (blobs are good for file storage), any of your role instances can access them, whether in Web Roles or Worker Roles. Also, Blob storage is durable meaning triple-replicated within the data center (and geo-replicated to another data center).

Regarding Worker Role instances not being able to access folders in a Web Role instance (or another Worker Role's instances), you're right. In fact, multiple instances of the same Role cannot access each other's file system (just remember that a Role is just Windows 2012 Server, and each instance of that Role runs in its own VM with its own local disks).

EDIT JULY 5 2014 This answer is now a bit old. Azure now offers a File Service, providing SMB shares which are backed by blob storage. This tends to be easier to work with for legacy applications that must use a file system and cannot be altered to directly read from / write to blobs. More information may be found here.

like image 171
David Makogon Avatar answered Oct 26 '22 14:10

David Makogon


Since data isn't persisted on the instances you'll need distributed storage where you can store your files (and other data). This can be done by using the Windows Azure Blob Storage (and this is very cheap compared to storing your files in SQL Azure).

like image 43
Sandrino Di Mattia Avatar answered Oct 26 '22 13:10

Sandrino Di Mattia


Azure storage is a good option. You can also look at using Local Storage Resources:

http://msdn.microsoft.com/en-us/library/windowsazure/ee758708.aspx

A local storage resource is a reserved directory in the file system of the virtual machine in which an instance of a role is running. Code running in the instance can write to the local storage resource when it needs to write to or read from to a file. For example, a local storage resource can be used to cache data that may need to be accessed again while the service is running in Windows Azure.

like image 38
Tom Avatar answered Oct 26 '22 13:10

Tom