Reputation: 14787
We have a multi-tenant system consisting of an Azure Web Role, Worker Role and Desktop/Mobile apps. Each client app allows uploading images that get routed to a tenant-specific Azure Blob Storage account.
The Azure Worker Role polls these files and processes them. We use third-party SDKs for processing that require either a file system path or a stream. Providing a stream directly from blob storage is trivial but the SDK also expects to spit out physical metadata files that our app consumes.
This is a problem since the SDK is a black box and does not provide an alternative. Is there a way to have local storage within worker roles for transient files. This storage is only required for a few seconds per worker role iteration and may be recycled/discarded if the role is recycled or shut down. In addition, the files are rather large (500MB+) so blob latency is not desired.
Searching around revealed some hacky workarounds, the best of which appears to be something that wraps blob storage to let our role access it as a file system.
Is there a way to simply have access to a file system similar to Web Role App_Data folders?
Upvotes: 1
Views: 476
Reputation: 1716
You can use RoleEnvironment.GetLocalResource() from within an Azure Worker Role to get a named handle to local file storage:
RoleEnvironment.GetLocalResource()
This will avoid hardcoding of specific file paths that may change over time, etc.
Good luck!
Upvotes: 3