Editing WordPress Optimization

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 240: Line 240:
 
===Configuration of Varnish via /etc/sysconfig/varnish===
 
===Configuration of Varnish via /etc/sysconfig/varnish===
  
This '''[http://wiki.mikejung.biz/Varnish Varnish]''' configuration file is used to configure the varnish daemon. We will be changing the listening port to 80 and configuring the malloc storage size based on the size of the instance used. I set this to 128MB for the 1GB VPS, you may need to tune this if you run into memory issues. You don't really need to configure Varnish to '''[http://wiki.mikejung.biz/Category:Caching cache]''' all the things, most of the time you will have a few pages / images that are accessed very often and a ton of other pages that are accessed less frequently, Varnish does a pretty good job at making sure the most used files are cached, and it will clear out files that are never accessed. It's best to wait a day or two and view '''varnishstat''' to get an idea of what your "warm" cache looks like. If you are seeing a lot of misses or that Varnish is utilizing all 128Mb, you can then consider raising this value.  
+
This Varnish configuration file is used to configure the varnish daemon. We will be changing the listening port to 80 and configuring the malloc storage size based on the size of the instance used. I set this to 128MB for the 1GB VPS, you may need to tune this if you run into memory issues. You don't really need to configure Varnish to cache all the things, most of the time you will have a few pages / images that are accessed very often and a ton of other pages that are accessed less frequently, Varnish does a pretty good job at making sure the most used files are cached, and it will clear out files that are never accessed. It's best to wait a day or two and view '''varnishstat''' to get an idea of what your "warm" cache looks like. If you are seeing a lot of misses or that Varnish is utilizing all 128Mb, you can then consider raising this value.  
  
 
For this file, we really only need to worry about two items, the listening port and the storage size. The listen port should always be set to 80. The storage size should scale with the instance size (how much RAM your server has). I was able to hammer my server with 1000 requests @ 10 concurrent connections and my server didn't even break a sweat with only 1GB of RAM, so this configuration should be pretty good for most sites.  
 
For this file, we really only need to worry about two items, the listening port and the storage size. The listen port should always be set to 80. The storage size should scale with the instance size (how much RAM your server has). I was able to hammer my server with 1000 requests @ 10 concurrent connections and my server didn't even break a sweat with only 1GB of RAM, so this configuration should be pretty good for most sites.  
Line 279: Line 279:
 
</pre>
 
</pre>
  
At this point you should be able to restart varnish and '''[http://wiki.mikejung.biz/Apache Apache]'''. If you have not yet changed Apache's listening port in cPanel Tweak settings, you should do so now. I suggest stopping Apache, starting up Varnish on Port 80, then going to WHM Tweak settings and changing Apache listen to 127.0.0.1:8080. If you get any errors with Varnish or Apache about a port already being used, make sure you stop the services first, or else there will be a conflict between Apache and varnish as to what port should be used by what application.  
+
At this point you should be able to restart varnish and apache. If you have not yet changed Apache's listening port in cPanel Tweak settings, you should do so now. I suggest stopping Apache, starting up Varnish on Port 80, then going to WHM Tweak settings and changing Apache listen to 127.0.0.1:8080. If you get any errors with Varnish or Apache about a port already being used, make sure you stop the services first, or else there will be a conflict between Apache and varnish as to what port should be used by what application.  
  
 
Running these four commands should get you on track once you have updated Varnish to listen on port 80 (all interfaces) and Apache on port 8080 (127.0.0.1 only). Leave Apache SSL port 443 alone, Varnish doesn't do SSL, so you will have to use Apache for SSL traffic.  
 
Running these four commands should get you on track once you have updated Varnish to listen on port 80 (all interfaces) and Apache on port 8080 (127.0.0.1 only). Leave Apache SSL port 443 alone, Varnish doesn't do SSL, so you will have to use Apache for SSL traffic.  

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)