开发者

WCF Service: ASP.NET Cache or SQL

I'm开发者_开发百科 currently developing a WCF REST Web Service that will be running on Microsoft Azure. To limit the number of requests per IP address to prevent abuse, I currently store the IP and timeout using the ASP.NET Cache.

This method works great but since muliple VM instances with Azure don't share a single cache, the requests could be split between different VMs and be cleared if a VM is reset.

I don't think this is a major problem but since I already store user info in a SQL Azure database and authenticate users using the WCF service, would I be better off using the database instead of the ASP.NET cache?

Any adive would be really helpful.


What about using a hybrid approach? You could store it into the SQL database in addition to putting it in your cache. Then when they hit a different instance it is put into the cache with the time that was stored in the database. Minimizes round trips to the database, and makes the information available to all of the servers.


You have to decide when the threshold is acceptable.
Data from cache will be faster, but there's a risk it doesn't represent actual current data. Where fetching data from the database is fresh, but it takes time to make the trip to the database and back.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜