How to Improve Web Performance and Scalability using Varnish

Varnish Cache

Varnish is a state-of-the-art, high-performance HTTP accelerator. It uses the advanced features in Linux 2.6.  Varnish supports Edge Side Includes, ESI. Edge side includes allow you to break your pages into smaller pieces, and cache those pieces independently.

Default start up

 varnishd -a :80 -b localhost:8080 -T localhost:6082 -s file,/var/cache/varnish.cache,256M
 varnishd -a -b localhost:80 -T localhost:6082 
-s file,/var/cache/varnish.cache,256M
-a gives the IP:port varnish should listen on, 
-b gives the IP:port of the backend handling web server

To stop varnish
 /etc/rc.d/init.d/varnish stop

Scaling PHP applications with Varnish

Using Varnish with Drupal

When setting up varnish using the default configuration in front of your application (in my case : a PHP app), you’ll probably notice that varnish caches nothing.

An example setup of Varnish, Apache and MediaWiki on a single server outlined.

Varnish logs and other notes

Drupal performance and scability

Video from Drupalcon

RPM for Varnish

Sites that use Varnish

Twiter, Facebook, Wikipedia, Hulu,