如何使 webfarm 中的 OutputCache 失效?
我有一个使用 OutputCache
属性来缓存页面的网站。效果很好。
现在,我正在研发将该网站扩展到网络农场中。除了常见的网络农场问题之外......我注意到(很快/明显)来自Server_A的OutputCache不会使来自Server_B的OutputCache无效..如果尝试使单个服务器的OutputCache无效。这完全有道理 ->当 S_A 在物理上是两台独立的机器时,S_A 如何“告诉”S_B 使其无效,等等?
那么 - 我们的选择是什么?
速度?我知道这会将缓存移动到不同的层..这意味着始终需要确定最终结果(输出)..与记住最终输出内容的OutputCache相反(是的,varby给出了不同的版本,等等..这完全没问题)。因此,即使 poco 或业务对象全部同步,仍然需要最后的渲染工作(即使与生成/同步业务对象的工作相比,它很小......)。
所以是的..不确定这里的选项以及其他人做什么?
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 -> how 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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
正如您上面所说,ASP.NET 输出缓存是在每个服务器的基础上进行开箱即用的。然而,在 ASP.NET 4.0 中,整个缓存基础结构是可插入的。 ScottGu 有一个 博客文章,介绍如何利用此功能进行输出缓存。我编写了一些使用 Velocity/AppFabric 作为缓存引擎的演示代码,它应该可以实现您想要的功能 - 请查看我的博客此处。
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.
看看 memcached
来自 维基百科
.NET 客户端此处
不幸的是,它在 Windows 上运行得不太好。它可以安装,但最好的集成是与 Linux 集成。
Take a look to memcached
From wikipedia
A .NET Client here
Unfortunately it doesn't work very well with windows. It can be installed but the best integration is with linux.