原贴:http://www.iuiuiu.com/plog/post/2/313
Varnish - 高效的 HTTP accelerator
04/11/2007
这几天在 google 找别的东西的时候看到 Varnish,其项目主页上的简单介绍:
Varnish is a state-of-the-art, high-performance HTTP accelerator. Varnish is targeted primarily at the FreeBSD 6 and Linux 2.6 platforms, and will take full advantage of the virtual memory system and advanced I/O features offered by these operating systems.
Varnish 的主要开发者是 Poul-Henning Kamp,是 FreeBSD 方面的专家。Varnish 从根上设计的就是作为反向代理使用的,作者认为 squid 等有点过时了,没有考虑到现在硬件的发展,而 Varnish 是相当的 modern~~,在他写的这篇 ppt 中有详细介绍。Varnish 网站上称在相同硬件条件下效率要比 squid 高 10-20 倍, 目前在挪威最大的报社 Verdens Gang (http://www.vg.no/)上运行,据说用 1 台 Varnish 替代了原来 12 台 squid,效率还是很可观的。
安装使用也比较简单,启动 varnishd 加速本机的 8080 端口:
varnishd -a :80 -b localhost:8080或者使用 Varnish configuration language (VCL) 文件来配置:
backend webserver {
set backend.host = "localhost";
set backend.port = "8080";
}
sub vcl_recv {
if (req.http.host ~ "") {
set req.backend = webserver;
} else {
error 404 "You requested a document from an unknown virtual host.";
}
}
项目主页上提供的文档不是很多,google 到一篇 Working with Varnish and Plone,有大致的解释和示例,更多的信息得去 man 里找。