开发者

How to invalidate the OutputCache in a webfarm?

i've got a website that uses OutputCache attribute to cache pages. Works great.

Now, I'm in the middle of R&D'ing scaling up this site to be in a web farm. Along with the usual suspects for webfarm pain ... I've noticed (pretty quickly/obviously) that the OutputCache from Server_A doesn't invalidate the OutputCache from Server_B .. if a try and invalidate a single server's OutputCache. This makes total sense -> h开发者_如何转开发ow can S_A 'tell' S_B to invalidate when they are physically 2 seperate machines, etc?

So - what are our options?

Velocity? I understand this will move the caching to a different layer .. which means that the final result (output) will always be required to be determined .. as opposed to the OutputCache whic remembers the final output content (yes, varby gives different versions, etc.. which is totally fine). So even though the poco or business objects are all sync'd, there's still that last rendering effort required (even if it's tiny .. compared to the effort to generate/sync business objects).

So yeah .. not sure of the options here and what other people do?


As you say above, ASP.NET output caching out of the box works on a per-server basis. However in ASP.NET 4.0 the whole caching infrastructure is pluggable. ScottGu has a blogpost on taking advantage of this for output caching. I've written some demo code that uses Velocity/AppFabric as a caching engine, which should do what you want - have a look at my blog here.


Take a look to memcached

What is Memcached?
Free & open source, high-performance, distributed memory object caching system, generic in nature, but intended for use in speeding up dynamic web applications by alleviating database load.

From wikipedia

The system is used by several very large, well-known sites including YouTube[2], LiveJournal, Wikipedia/Wikimedia, Amazon.com, Wikia, SourceForge, Metacafe, Facebook[3] [4], Twitter[5], Fotolog, The Pirate Bay[6] and Netlog.[7]

A .NET Client here

Unfortunately it doesn't work very well with windows. It can be installed but the best integration is with linux.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜