2012年4月13日 下午 11:25
I am very new to Azure, and am using the free account for MSDN subscribers. I want to have a single service which will run constantly (I think I can run a "small" instance 24/7 with the free hours).
The service will download data from an external resource, format it nicely, and then provide that to my application when it requests it. But I need this to be VERY low latency. So I don't want to use the usual way of caching where when there is a request it check if the cache is expired and reloads it - I want the cache to always be up to date.
So is it possible that I can give it a method to run every time any cached object expires (regardless of whether there is an app requesting this) where I will update it?
Also, I see that data coming in is not metered, so constantly refreshing the cache from an external resource should be fine. It's a small amount anyway, and only every 10 minutes or so.
2012年4月14日 上午 07:21版主
As far as i know, i think Cache is useful for something was accessed frequently, so i do not think everything is fit Cache, and Azure Caching service maxinum is 4GB. If the cache onject is expired, the first request will be redirected to the original address for new data, and Caching service will help to save the "new version" of data, the following request can aslo get them from Caching service.
If you still want to use your own handlers to management cache, try to set caching service expire time as a fixed value (such as 10 minutes in your situation), create a WorkRole and execute every 10 minutes (expire interval time) to update data with Azure Caching service. This workroke is the back-end application running the cloud.
More details about how to work with Azure Caching service:
Hope this helps.
2012年4月14日 上午 09:46
Ok so I hope I am understanding correctly: I will run a WorkRole which will have a sleep of 10 minutes, and every 10 minutes it will download the new data and replace it in the cache. And then as a seperate WebRole I will have my actual webservice which will give that cached data to an app that calls it?
If that is correct, then I have one more question:
Do I setup two seperate "hosted services", one being the WorkRole, and the other being the WebRole? And if I write to cache in the one, will the other be able to read it by default?
2012年4月14日 上午 11:04版主
Yes, but no need two hosted service in Windows Azure Mangement Portal, just deploy it as a work role in cloud application, but i do not think it's a good choice to do that, because if your application will be accessed frequently, the requests will be nearly in the same time, it's may not works as experts. But it's not so frequent, you can have a try.
Hope this helps.
- 已標示為解答 Arwind - MSFTModerator 2012年4月20日 上午 08:17