Difference between revisions of "Package:Varnish"

From Funtoo
Jump to navigation Jump to search
(add apache benchmarking)
Line 10: Line 10:

Install {{Package|www-servers/varnish}}
Install {{Package|www-servers/varnish}}:
<console>###i## www-servers/varnish</console>
<console>###i## emerge www-servers/varnish</console>


Revision as of 22:09, September 12, 2014



We welcome improvements to this page. To edit this page, Create a Funtoo account. Then log in and then click here to edit this page. See our editing guidelines to becoming a wiki-editing pro.

Varnish is a webcache & http accelerator. Varnish will either serve cached content, or retireve content from the server, and cache it. Varnish will reduce I/O pressure from webservers.



Install www-servers/varnish:

root # emerge www-servers/varnish


Configuration is controlled by /etc/varnish/default.vcl & /etc/conf.d/varnishd

   /etc/varnish/default.vcl - varnish configuration file
vcl 4.0;
backend default {
    .host = "";
    .port = "8080";
   /etc/conf.d/varnishd - varnish configuration file
VARNISHD_OPTS="${VARNISHD_OPTS} -u varnish -g varnish"

Varnish will fetch data from localhost:8080 and serve accelerated proxy data on localhost:80


To start varnish immediately:

root # rc-service varnishd start

To start varnish at boot:

root # rc-update add varnishd default


To verify that your traffic is going through varnish.

user $ curl -I https://www.varnish-cache.org/


If your system has apache installed apache benchmark can show the power of varnish. The examples shown are running 500 requests with concurrency of 100 hits.

ab against a 3 worker cluster mode puma server

root # ab -n 500 -c 100 | grep Request

Requests per second: 110.92 [#/sec] (mean)

ab against the same server served through varnish

root # ab -n 500 -c 100 | grep Request

Requests per second: 10268.42 [#/sec] (mean)