Nginx 反向代理缓存失效策略
我一直在使用 Nginx 0.8.5 作为缓存反向代理来构建自定义的类似 cdn 的解决方案,以加快我们网站的加载时间。到目前为止,它的效果很好,只是缓存失效确实很麻烦,即使安装了缓存清除模块也是如此。
例如,有时我们可能需要一次使 100 个 url 失效,这需要向每个缓存反向代理服务器发送 100 个不同的请求。
如果只设置两台缓存服务器,这几乎不起作用,而我们的计划是扩展到 20 台服务器,因此我们需要找到更好的解决方案。有什么想法吗?
简单地重新配置 Nginx 是行不通的,我确信我们需要自定义一些东西。我们不想参与自定义 Nginx 模块开发。
I've been using Nginx 0.8.5 as a caching reverse-proxy to build out a custom cdn-like solution to speed up our site's load time. It works great so far except that cache invalidation is really cludgy, even with the cache purge module installed.
For example, sometimes we may need to invalidate 100 urls at once, and this requires 100 different requests to get sent out to each Caching reverse-proxy server.
This hardly works with just two cache servers set up, and our plans are to scale to 20 servers, so we need to find a better solution. Any ideas?
Simply reconfiguring Nginx won't work, and I'm sure that we will need to custom-code something. And we don't want to get involved in custom Nginx module development.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
也许这种方法会对您有所帮助: 清除缓存(最后)
基本上不使用清除模块,它们只是向您展示如何直接删除 nginx 文件,因此您可以制作一些简单的脚本来获取 url 并直接清除它们
maybe this approach will help you: Purging the Cache(in the end)
basically instead of using the purge module they just show you how to delete the nginx files directly, so you can make some easy script that will get urls and will purge them directly