I have a web application and windows service that access the same set of files. I use a named semaphore to stop it from accessing the information at the same time (service or web server requests to have access to the directory, uses it quickly, releases the semaphore).
I want to run this application on Windows Azure. I think using a Virtual Machine would be nice because then I can use a named semaphore to control access, then run both the web server and windows service on the VM. The issue is that the Virtual Machine seems to be kind of limited in space. I need to use way more storage than what is offered for Virtual Machines. I'd also be missing out on the geographically redundant storage.
Is it possible, in Windows Azure, to have a named semaphore shared between a Cloud Service and Web Site? Maybe I need a separate service that has exclusive access to these files and communicates with the both the service and website? That would suck to have to program another service and spend the extra money per month on it. Is there a better way?
Edit (more info):
- Scaling is definitely needed. There's going to be a lot of data stored and I'm concerned it will outscale the VM in the future.
- They are not database files. They are individual files with a separate directory that has many different indexes. I'm concerned about the windows service and web server trying to access the same index at the same time (though a rare occurrence).
- I believe a storage blob would work well in this case.
- A lease blob would not be good. 15 seconds is too long to wait.
What I think I'll do:
I'll probably have a VM running both the windows service mentioned above and an extra service that does nothing but "manages locks" on the specific indexes and files that are located in a blob. So... the web server or windows service will request a "lock" from this service. That way both application can work directly with the files and it will take less development time to get that going.
Edit 2:
Or maybe I could just put everything on a VM, use a named semaphore, then access the storage blobs (probably the best option for now)