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 192.168.1.16:80 -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
- Drupal will serve content to authorised, logged in users, as well as anonymous users on the same URL.
- Drupal 7 supports the basic cache-control headers which are necessary to use Varnish as a cache for full pages. Pressflow backports this functionality to version 6.x for those who need it.
-
Drupal Module Varnish HTTP Accelerator Integration
-
Step-by-step: Setting up Varnish, Apache, APC and Solr Project Mercury Style
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.
Drupal performance and scability
Sites that use Varnish
Twiter, Facebook, Wikipedia, Hulu, Drupal.org