WordPress is one of the most popular content management systems (CMS) in use today. As a business owner, content publisher or web site developer getting the best performance from your WordPress site will be important to you.Increasing performance encourages visitors to return and engage more with your content or services.
Every WordPress site needs a host, and selecting the right hosting partner has always been a key starting point to success. Our VMware VPS Hosting solutions for Linux are built on the industry leading VMware ESXi & vSphere virtualization platform. FASTDOT’s VMware VPS Hosting offers the highest level of stability and performance available for virtualized environments.
But no matter how powerful your VPS hosting solution is, the key to real performance is fine-tuning the software stack makes up your WordPress site. There are many parts of the stack including the Apache web server, MySQL database, PHP, server side caching and WordPress itself that can all be adjusted so as to get the best performance possible. This article will show you how to optimise WordPress for your VPS or Dedicated Server.
MySQL has been proven to be a fast and scalable relational database platform and there’s no reason why it can’t drive large, highly trafficked WordPress sites.
Enable the Query Cache
One of the best ways to speed up your web application is to enable query caching in your database, which caches commonly used SQL queries in memory for virtually instant access by the next page that makes the same request.
This will make sure that MySQL is doing as little work as possible, freeing up resources for more important things than redundant queries.
You can learn more about the query cache via the MySQL support site: http://dev.mysql.com/doc/refman/5.1/en/query-cache.html
Use MySQL Tuner
MySQLTuner is a script written in Perl that allows you to review a MySQL installation quickly and make adjustments to increase performance and stability. The current configuration variables and status data is retrieved and presented in a brief format along with some basic performance suggestions.
You can learn more about the MySQLTuner script at:
Switching to the InnoDB engine
For high traffic sites switching to InnoDB as the default storage engine for MySQL may improve performance. You won’t compromise any native WordPress functionality by making the switch, however the performance gains will vary and are dependant on how many read and writes are being committed to the database. MySQL 5.5 and later now use InnoDB by default.
You can learn more about the InnoDB engine via the MySQL support site: https://dev.mysql.com/doc/refman/5.5/en/innodb-introduction.html
Your WordPress database stores all of your website content. This includes blog posts, pages, comments, and custom post types such as links, form entries, and portfolio items. It also stores website settings, theme settings, and plugin settings.
If you update your website regularly, your database will grow larger over time. A large database can greatly affect the performance of your website as it takes longer for your server to retrieve information from database tables.
To learn more about how to optimise your WordPress database go to: http://premium.wpmudev.org/blog/optimizing-your-wordpress-database-a-complete-guide/
There are many different types of caching, including web page caches, hardware caches, software caches and memory caches. Caches are used to speed up a process so that data does not have to be recomputed or fetched from its original location and, therefore, saves time.
In the context of WordPress there are a variety of caches that can be implemented, that help to speed up PHP execution (opcode caching), commonly used objects or data (object caching), entire pages (page caching) and previously visited pages stored in your visitors web browser (browser caching).
You should review all these forms of caching to see which combination yields the best performance results for your WordPress site.
Like many other modern web applications, WordPress is written in a popular scripting language called PHP. Web pages written with PHP require the web server to run through the contents of the script and execute it each time it is viewed. With thousands of visitors potentially arriving to your site this process can be a potential bottleneck.
A PHP accelerator such as Alternative PHP Cache (APC) will help to reduce server overhead in processing PHP code by caching previous requests and thereby avoid the parsing and compiling of PHP source code each and every time a page is visited.
APC also offers an object cache, allowing objects you create to be stored in memory right next door to the scripts that need them. The only drawback to this level of caching is that it’s local to each respective application server you have.
You can learn more about the PHP APC Accelerator at:
Page Caching is a service that allows dynamic web page content to stored and generated as static HTML files. Popular pages are retrieved from the page cache and not generated dynamically from the WordPress database each time a visitor arrives. This provides a considerable improvement in performance particularly if you have hundreds or thousands of visitors arriving each day.
All HTTP requests made by the browser are first routed to the browser cache to check if there is a valid cached response that can be used to fulfill the request. If there is a match, the response is read from the cache and we eliminate both the network latency and the data costs incurred by the transfer.
Leveraging the browser’s cache is one of the biggest performance wins available and be easily implemented either via your web site’s .htacces file or through the use of a third party caching plugin such as W3 Total Cache or WP Super Cache.
Minification is vital to improving end user experience. Reducing the file size and number of files, and there the number of HTTP requests has a dramatic impact on a visitors experience with your site.
There are various tools for WordPress that support the minification process including the previously mentioned caching plugins W3 Total Cache or WP Super Cache.
When making a selection, ensure you pick one that caches the minified files to disk, respects the differences between templates, supports local and remote files and most importantly is compatible with popular content delivery networks and mobile plugins.
Website Code Can Take Much Space!
One thing that makes WordPress so popular is that it does the coding for the writer. In fact, it’s not all that unusual for WordPress hosts to learn that their clients have never checked out the HTML (Text) tab; for some, it’s akin to going over to the Dark Side.
- CSS is a language that creates templates for web pages, saving time on rewriting HTML over and over again
Loads of code, though, will slow down your WordPress site, which is a huge turn-off for would-be visitors. The right plugin can fix this quickly and easily.
Minify & Combine Code
There are plenty of WordPress plugins that remedy the problem of coding hogs. What they do is cut down the amount of space these codes take by combining redundant codes and minimising space between codes. It’s like forcing the codes to go on a diet.
Why is this necessary? Because the line breaks a coder puts in means more space needed for that page. Coders need these breaks; it helps them keep track of their work and reduces errors. But taken together, these breaks simply require more bandwidth to work, which in turn slows download time. This, as you know, is unacceptable, particularly as more people search on mobile devices where fast download is essential.
Example of minified CSS
Minification takes out the line breaks coders need but the Internet doesn’t. According to CleanCSS.com, a site that demonstrates coding minification, this can reduce download speeds by up to 20%.
Most WordPress plugins that address minification do not aggregate, or combine, codes. Autoptimize is one that does both by:
- Creating links (“concatenate” in WordPress lingo) for scripts and styles spelt out in various codes
- Moves CSS style coding to headers, an element Google prefers
- Moves codes for scripts to footers
- Compresses HTML space
Autoptimize recommends installing page caching plugins like WP Super Cache.
Reverse proxies often provide caching that sits between the web application and the public Internet. Its goal is to lighten the load on the web servers behind them. Reverse proxies are optimized for returning content generated by the underlying application. Varnish, Nginx or even Apache can be configured to provide reverse proxy functionality.
Reverse Proxies are a more advanced form of caching as they usually require another server to be configured that acts as the proxy. For a small scale WordPress site with a low amount of traffic this may not be a feasible option, however for very large sites this technique will increase performance considerably and ease the load of your main web server.
For an Apache based configuration running cPanel/WHM you can implement a reverse proxy using the mod_proxy Apache module.
Content Delivery Network
A content delivery network or content distribution network (CDN) is a large distributed system of servers deployed in multiple data centers across the Internet. The goal of a CDN is to serve content to end-users with high availability and high performance.
With a CDN, it doesn’t matter where your site is hosted. If you have visitors in other parts of the world, the CDN caches that content close to them and shaves seconds off of the total page load time for your site.
Popular CDN services, some of who provide a free account and plugins for WordPress, are CloudFlare, Incapsula, CBN.net and Photon.