开发者

AppFabric Caching for large scale web sites

开发者 https://www.devze.com 2023-03-06 12:50 出处:网络
Our web application is deployed in a web farm (more than 20 servers). The site has a huge traffic (millions of page viewsper day).

Our web application is deployed in a web farm (more than 20 servers). The site has a huge traffic (millions of page views per day). In the first release, this application is using EntLib's CacheManager (Entreprise application block caching). We call this "Local Server Cache". There are many benefits but we still have a major drawback : each server manage its own cache and acces to database (not distributed).

That's why we are trying to implement AppFabric caching feature in order to reduce database round trips. One of the major problem we have is data synchronisation :

  • with GetAndLock/PutAndUnLock (aka distributed lock) page response time is higly affected
  • with Get/Put + simple server side lock, we have so many requests with the local cache ; no benefits.

So what are caching stragegies for large scale web si开发者_开发问答tes ?

Thanks,


I would say cache read only data as much as possible. For this you can use AppFabric Caching Service. You can setup a cluster of let's say 5 cache servers. Then all of your 20 front-end servers would talk to this cache cluster to get cached data. You can also take advantage of keeping the most frequent data directly on front-end (local cache). For example our configuration is this:

  • front-end (16 machines) with LocalCache to store 150.000 most frequently used items
  • cache cluster (4 machines) with HighAvailability mode storing all data to cache
  • database (1 machine) with all the data

It gets more tricky for data that you want to update. Every time you introduce locks, your performance will suffer.


As I'd mentioned on MSDN, immediate consistency is expensive. You have to accept some tradeoffs in consistency, or lay out a lot of cash to be immediately consistent. Using the isolated read/write model we discussed on MSDN, along with queues, probably provides you the best performance/consistency bang for the buck. Multiple tiers of cache as suggested by David are also excellent, depending on your overall architecture/design. Using your own local in-proc or localhosted cache implementation also offers a lot of value -- not a fan of AppFabric's OOTB local cache myself.

--ab

0

精彩评论

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