如果底层应用程序不可用,什么是好的缓存反向代理可以提供过时的内容?
我正在寻找一个缓存反向代理(例如鱿鱼或清漆),能够在发生故障时提供良好的支持来提供过时的内容 - 换句话说,如果我代理的应用程序消失或开始提供内部服务器错误,我'我希望缓存继续提供从后端保存的最后一个好的响应。 本质上,我希望缓存服务器在出现问题时充当额外的保护层。
有没有人配置过 Squid 或类似的东西来做到这一点? 知道有哪些产品支持开箱即用吗?
I'm looking for a caching reverse proxy (something like squid or varnish) with good support for serving stale content in the event of failure - in other words, if the application I'm proxying goes away or starts serving internal server errors I'd like the cache to continue to serve the last good response saved from the back end. Essentially I want the cache server to act as an extra layer of protection should something go wrong.
Has anyone configured Squid or similar to do this? Know of any products that support this out of the box?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
Squid 在 2.7 版本中可以做到这一点。 具体来说,使用 stale-if-error 指令。 更多详细信息请访问:
http://www.mnot.net/blog /2007/12/12/陈旧
Squid can do this in version 2.7. Specifically, use the stale-if-error directive. More details can be found at:
http://www.mnot.net/blog/2007/12/12/stale
看起来 Varnish 还不能处理这个要求: http://varnish.projects.linpro .no/ticket/369
It looks like Varnish can't handle this requirement just yet: http://varnish.projects.linpro.no/ticket/369
这取决于“不可用”的时间有多长。 Squid 有一个配置“refresh_stale_hit”,其主要目的是通过允许在更新缓存时提供稍微陈旧的内容来消除一些延迟。 不过,可以肯定的是,它不会覆盖从网络服务器获得错误响应的情况。 有一个完整的“离线”模式,将继续提供缓存结果(专为...等待...离线使用!),因此代码路径在那里:不确定是否可以将其配置为两个代理好的结果,忽略坏的结果。
It would depend on how long 'unavailable' is. Squid has a config 'refresh_stale_hit' which is mostly designed to remove some latency by allowing slightly stale content to be served while the cache is updated. Pretty sure it won't override getting a bad response from the web server, though. There is a full-on 'offline' mode that will keep serving cached results (designed for ... wait for it ... offline use!) so the code paths are in there: not sure if you can configure it to both proxy good results, and ignore bad ones.