|Source Repository:||Gentoo Portage Tree|
Summary: Varnish is a state-of-the-art, high-performance HTTP accelerator
- Build additional tools: varnishhist, varnishstat, varnishtop, varnishsizes
- Use dev-libs/jemalloc for allocations
Pre-built kernels!Funtoo stage3's are now starting to offer pre-built kernels for ease of install. read more....
Better Experiences: Ego and VimInfo on Funtoo's new personality tool called 'ego', and user-focused updates to vim's defaults.
How We're Keeping You At the Center of the Funtoo UniverseRead about recent developments that keep you, our users, at the forefront of our focus as Funtoo moves forward.
Varnish is a Web cache and HTTP accelerator. Varnish will either serve cached content, or retrieve content from the server, and cache it. Varnish cache will reduce I/O pressure on Web servers.
# emerge www-servers/varnish
as your varnish is local to your server, your server needs to be aware that it is behind a proxy, and configured for x-forwarded-for or similar to fetch real users IP addresses instead of displaying 127.0.0.1 or localhost.
Configuration is controlled by /etc/varnish/default.vcl & /etc/conf.d/varnishd
Varnish will fetch data from localhost:8080 and serve accelerated proxy data on localhost:80
For 10,000 concurrent connections -- or not -- a few configuration settings control the power of varnish. If you're having varnish directly serve to the outside world, dial back concurrency to say 50 or 100 connections per IP. You must take into account corporations and universities hammering several connections from a singular IP. c10k is useful information for if varnish is behind a load balancer such as pound, nginx, or tengine, and all requests are internal and local.
To start varnish immediately:
# rc-service varnishd start
To start varnish at boot:
# rc-update add varnishd default
To verify that your traffic is going through varnish, and see if you're getting hits or misses:
$ curl -I http://www.funtoo.org/Welcome
Apache-tools apache benchmark can show the power of varnish. The examples shown are running 500 requests with concurrency of 100 hits.
- Example 1
- ab against a 3 worker cluster mode puma server
# ab -n 500 -c 100 http://127.0.0.1:3000/index.html | grep Request
Requests per second: 110.92 [#/sec] (mean)
- Example 2
- ab against the same server served through varnish
# ab -n 500 -c 100 http://127.0.0.1/index.html | grep Request
Requests per second: 10268.42 [#/sec] (mean)
Varnish does not support ssl. There are packages to get around this limitation:
- net-misc/stunnel (package not on wiki - please add)
- www-servers/pound (package not on wiki - please add)