04/11/2007
這幾天在 google 找別的東西的時(shí)候看到 Varnish,其項(xiàng)目主頁(yè)上的簡(jiǎn)單介紹:
Varnish is a state-of-the-art, high-performance HTTPaccelerator. Varnish is targeted primarily at the FreeBSD 6 and Linux2.6 platforms, and will take full advantage of the virtual memorysystem and advanced I/O features offered by these operating systems.
Varnish 的主要開(kāi)發(fā)者是 Poul-Henning Kamp,是 FreeBSD 方面的專(zhuān)家。Varnish 從根上設(shè)計(jì)的就是作為反向代理使用的,作者認(rèn)為 squid 等有點(diǎn)過(guò)時(shí)了,沒(méi)有考慮到現(xiàn)在硬件的發(fā)展,而 Varnish 是相當(dāng)?shù)?modern~~,在他寫(xiě)的這篇 ppt中有詳細(xì)介紹。Varnish 網(wǎng)站上稱(chēng)在相同硬件條件下效率要比 squid 高 10-20 倍, 目前在挪威最大的報(bào)社 VerdensGang (http://www.vg.no/)上運(yùn)行,據(jù)說(shuō)用 1 臺(tái) Varnish 替代了原來(lái) 12 臺(tái) squid,效率還是很可觀的。
安裝使用也比較簡(jiǎn)單,啟動(dòng) varnishd 加速本機(jī)的 8080 端口:
varnishd -a :80 -b localhost:8080或者使用 Varnish configuration language (VCL) 文件來(lái)配置:
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.";
}
}
項(xiàng)目主頁(yè)上提供的文檔不是很多,google 到一篇 Working with Varnish and Plone,有大致的解釋和示例,更多的信息得去 man 里找。
聯(lián)系客服