我应该使用 Varnish 而不是 nginx 吗?
我真的很喜欢 nginx。
但最近我发现 varnish 为您提供了实现智能缓存反转代理层(带有 URL 清除)的机会。我有一个杂种集群,它们非常消耗资源,所以如果这个缓存层可以消除杂种的一些负载,这可能是一件很棒的事情。
我没有找到一种方法来实现与 nginx 相同的缓存层(用于应用程序页面;静态内容当然是可缓存的)。
我应该使用 Varnish 吗?你会推荐什么?
I really like nginx.
But recently I've found that varnish gives you an opportunity to implement smart caching revers proxy layer(with URL purging). I have a cluster of mongrels which are pretty resource-intensive so if this caching layer can remove some load from mongrels this can be a great thing.
I didn't find a way to implement the caching layer(with for application pages; static content is cacheable of course) same with nginx..
Should I use Varnish instead? What would you recommend?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不知道你所说的“智能”是什么意思,但无论如何,Nginx 从 0.7 分支开始就有缓存。有许多参数需要调整,例如,
文档在这里
I do not know what you mean under "smart", but anyway Nginx has caching starting from 0.7 branch. There are many parameters to tune, e.g.
The documentation is here
如果你只需要非常基本的缓存,Nginx 有一些不错的功能,但是 Varnish 可以让你通过 URL 或标头匹配进行主动清除,边缘包含所以页面的不同部分可以有不同的 TTL,以及许多其他技巧,因为它有一个非常灵活的配置语言。
如果你真的想认真缓存并减少后端的负载,我会选择 varnish,但是设置起来比仅仅在 nginx.conf 中添加一些指令要多得多。
Nginx has some nice features if you just need very basic caching, but Varnish lets you do active purges by URL or header matching, edge side includes so different parts of your pages can have different TTLs, and lots of other trickery because it has a very flexible configuration language.
If you really want to seriously cache and reduce load on your backends, I'd go with varnish, but it's going to be a lot more work to set up than just adding a few directives to your nginx.conf.