Jump to navigation Jump to search


18 bytes added, 17:46, 14 March 2015
Varnish Overview
==Varnish Overview==
Varnish is a "web accelerator" that acts as an HTTP reverse proxy, basically Varnish is the front of the line for serving requests. Apache sits behind Varnish and serves requests only to Varnish if the content is not already in the Varnish cache, or cannot be cached for whatever reason. Images, css, html, and a lot of other stuff can be '''[ cached] ''' by Varnish which means Apache does less work, which generally means a happier server and a fast website.
Any time you access something from RAM the access time for that file becomes faster, since Varnish can store a large amount of files in RAM, it can significantly improve performance. I've seen performance boosts of 10x to 100x simply by sticking Varnish in front of WordPress. There is a [ VCL] language that you can use to set rules about what to do with a certain type of request, what files to cache, what files not to cache, and for how long to cache said file.
Installing Varnish is a rather simple process. Configuration can sometimes be a little more tricky, especially with the default.vcl file. While you can create some very complex VCL rules and complex configurations, you can also just leave the default.vcl alone and run with the defaults, it may not be optimal, but it'll still probably be faster than just sticking with Apache!
If you aren't already using something like '''[[Php-fpm]] ''' or '''[[HHVM]] ''' for PHP, you may still notice slow loading times. Varnish can only help so much if your database server is slow or you are using something like SuPHP to run PHP.
Varnish can also be used to load balance HTTP requests between multiple backend servers. Varnish is obviously RAM hungry, the whole point of caching is to use as much RAM as possible so you should give Varnish enough RAM to fit most of your www/ content into it's cache. Varnish is not very CPU intensive unless you are getting large amounts of requests. Varnish running with a single core on a VPS can handle at least 100 request/s if not much more.

Navigation menu