I have a cloud service hosted out in Azure. Due to the amount of data it uses, we have an hourly process that tells the service to cache data into memory. To update the cache, we use an exposed method called "RefreshData" that we invoke on a scheduled task on a local server.
Recently I updated the cloud service to run on 2 instances (meaning it was running on 1 VM, its now running on 2).
What Im noticing now is that our data is no longer automatically refreshing to the most current data. What seems to be happening here is:
- A scheduled task to run a command executable is triggered at the top of the hour on a local server
- The exe calls out to http://myCloudService.cloudapp.net/service.svc, gets a response, and kicks off the RefreshData method
- The instance that received the refresh request is "random", meaning only 1 of the 2 instances is told to refresh the data. Therefore, sometimes a user using our service gets most current data, sometimes it can be up to a few hours stale.
So if I have a cloud service that responds to an IP, but there are 2 instances running "behind it" with individual IP's, how can I invoke this request and ensure that both are getting updated as needed?
PS - I'm aware that Azure has that "load balancer" tool now available, if needed Im perfectly comfortable using one instance as my primary and have the second instance work as a failover, if thats a plausable option here?
You have a few options: