How To Increase WordPress Speed
If you find yourself asking, “How do I increase WordPress speed?” this article is for you. This tutorial will be divided into two parts. The first part will cover things on the server side that can help to improve your site’s performance. The second part will discuss what can be done on the WordPress side to speed up your site even more.
Part 1: Server-Side Optimizations
To make these types of changes, you’ll need access to your website’s FTP or shell account. All web servers are configured slightly different but these settings should work in most cases with little tweaking needed if any at all.
PHP Opcode Caching – By default php script files are cached only during the runtime of a single request so any changes made after the page is initially generated will not be reflected on future page requests. To change this, you can use a php opcode cache to keep track of any changes made to your php scripts and then clear that information at the end of every request. In my opinion, APC ( http://www.php.net/manual/en/apc.installation.php ) or XCache ( http://xcache.lighttpd.net/wiki ) are the two most popular options for caching php opcode data in memory on most servers with APC being the more commonly used option by far due to its lighter resource usage and effective performance when compared to XCache or others IMO . You can configure both of these options through your php.ini file which usually can be found somewhere in your server’s web root directory such as: /usr/local/lib/php.ini .
Once you have them installed and setup, you’ll need to add the following settings to the opcache section of your php.ini:
opcache.memory_consumption=64 (This setting is very dependant on how much RAM you have available so I suggest playing around with this number until it works for your environment)
opcache.max_accelerated_files=10000 (this setting may require changing depending on how many PHP scripts are actively being used on your site)
opcache.revalidate_freq=60 (The revalidate_freq setting determines how often the opcode cache will check to see if any php scripts have been added, removed, or changed by checking the web server’s file modification timestamp . I suggest a value of 30 for busy sites or less depending on your needs)
opcache.fast_shutdown=1 (this option can greatly speed up shutdown time but may not be compatible with all servers/environments so play around with it and see what works best for you)
Remember to restart your web server after making any changes to your php.ini file! How much impact this type of caching will have really depends on which website you are hosting and what type of server you have. On average however, I have found this to usually double or even triple performance in most cases.
Enabling Gzip Compression – In order for your site to be able to take advantage of gzip compression, both the server and WordPress need to support it. This typically isn’t a problem but there are times when one side or the other won’t properly respond with gzip headers thus preventing the transfer of compressed data.
To check if gzip is working on your site, simply visit http://www.google.com/search?q=gzip+test&hl=en&lr=&safe=off . If you get back results like these (see image below) then your server is correctly sending gzip headers and you should be able to take advantage of this on your site.
NOTE: If you run across the following error trying to access a gzipped file, then chances are that someone has installed an htaccess or similar plugin that is preventing compression from working properly due to bad rules in their filters. You can either ignore it (just make sure the mod_deflate line is still included) or try disabling any plugins that may be interfering with compression. Alternatively, if you’re feeling adventurous, you could attempt modifying the htaccess file yourself but I would only suggest this approach as a last resort! For more information on how htaccess files work and for some common rules related to mod_deflate , check out the following links: http://us3.php.net/manual/en/ini.core.php#ini.htaccess http://us3.php.net/manual/en/mod-deflate.setup.php