Editing Varnish

Jump to: navigation, search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
Line 2: Line 2:
 
==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 '''[http://wiki.mikejung.biz/Category:Caching cached]''' by Varnish which means Apache does less work, which generally means a happier server and a fast website.  
+
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 [http://wiki.mikejung.biz/Category:Caching 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 '''[http://wiki.mikejung.biz/Category:Performance performance]''' boosts of 10x to 100x simply by sticking Varnish in front of WordPress. There is a [https://www.varnish-cache.org/docs/4.0/reference/vcl.html 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.  
 
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 '''[http://wiki.mikejung.biz/Category:Performance performance]''' boosts of 10x to 100x simply by sticking Varnish in front of WordPress. There is a [https://www.varnish-cache.org/docs/4.0/reference/vcl.html 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.  
Line 10: Line 10:
 
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]]'''!  
 
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.  
+
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.
 
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.

Please note that all contributions to wiki.mikejung.biz may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see wiki.mikejung.biz:Copyrights for details). Do not submit copyrighted work without permission!

Cancel | Editing help (opens in new window)