Cloudways 10 Killers Tips To Optimize WordPress For Peak Performance

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

Aaqib is a Co-founder and Director of Cloudways, a Managed Services Provider (MSP) based

in Mosta, Malta. Aaqib is a DevOps enthusiast and has a passion for Cloud Computing, Open
source application development and Big Data. His responsibilities at Cloudways include
strategic planning, product and business development.

Connect with Aaqib on LinkedIn

ROBUST MANAGED CLOUD HOSTING SOLUTIONS
ordPress has covered a journey which is unparalleled, especially when we see how it has evolved from a
simple blogging tool to a powerful content management system. It has become the de-facto CMS, and
powers more than half of worlds top 100 websites. This is because WordPress did not come into existence
as an incident. It was based on the need to have a well architected and refined publishing tool. A decade down the
lane, it has successfully achieved this.

So why should you be reading this guide? Since our earliest days in this industry, Ive seen many making critical
mistakes. These mistakes clogged, if not killed, the performance WordPress is known for. Here are some tips for fixing
some of the most common issues. After implementing these, your WordPress site will deliver guaranteed results. And
all of this can be done within a week.


Lets keep this one short. This guide can be helpful to both businesses and independent developers. These tips include
pre-deployment vis--vis design/development stage optimization, as well optimization techniques for up and running
WordPress websites.


Everyone likes images but putting too many of them might make your website slow.
Most people believe that an abundance of rich graphics is necessary for a unique look
and feel. Every image takes time to render and too many images leads to increased
page load time (which can also affect your search ranking). The best thing you can do
is to consider every single element on your page, and if anything seems unnecessary,
remove it (including plugins).

Minimalistic web designs not only load quickly but they also improve engagement
and increase conversion. Similarly, using a streamlined and responsive HTML5 theme
will make your site both browser and search engine friendly, besides facilitating
readability on various screen sizes.

Plugins extend the capability of WordPress , however, a plugin with bad code can
create security issues and make your site slow to a considerable extent. Apart from
that, using too many plugins can be a reason for sending additional HTTP requests to
your server and increase load time (though a few tweaks can fix this problem).

If your plugin is resource extensive and is sending many DB requests, you might need
to create a custom solution.

You should do your research before opting for a custom solution. WordPress plugins
such as Jetpack and Akismet are overseen by the WordPress team, so you can install
them without any worries.

Developers have different opinions when it comes to inserting JavaScript in the
<head> or <body> of the web page. Website optimization experts are of the view
that placing the JS in the <head> will force the browser to keep everything else on
hold until it loads the script; an approach that can make the page susceptible to high
load time (especially true for social media plugins).

The best way to solve this problem is to create an event that executes JS and external
snippets after the entire page is rendered. There are a few ways to do this, one of
which is to create a window.onload attribute like this:



























WordPress 3.6 was launched last week, and it is suggested that you upgrade as soon
as possible. Using older versions of an application not only makes your site prone to
security risks but you are also missing out on the performance and optimization
tweaks, as well as new featuressuch as the inclusion of a native video player in WP
3.6 (which means that you can get rid of a plugin on two).

Updating WordPress core and Plugins to latest, stable versions also optimizes your
WordPress for better performance, due to better compatibility.
<!doctype html>
<html>
<head>
<script type="text/javascript">
//Not the best way to embed an onload event, but you get
the idea.
function loadAsyncFiles(Path)
{
//Generate Script TAG
var scriptTag = document.createElement("script");
//Set Script TYPE Attribute
scriptTag.type = "text/javascript";
//Set Script SOURCE Attribute
scriptTag.src = Path;
//INCLUDE Current Script in HEAD SECTION
document.getElementsByTagName('head')[0].appendChild(scr
iptTag);
}
</script>
</head>
<body>
<script type="text/javascript">
//Load JQUERY SCRIPT
loadAsyncFiles('http://code.jquery.com/jquery-
1.10.2.min.js');
//Load REQUIRE.JS SCRIPT
loadAsyncFiles('http://requirejs.org/docs/release/2.1.8/
minified/require.js');
//Load BACKBONE.JS SCRIPT
loadAsyncFiles('http://backbonejs.org/backbone.js');
</script>
</body>
</html>


By default, every plugin will load its own JavaScript/CSS files individually when the
page is rendered. By combining and compressing JS and CSS files you can reduce the
overall page size. This also means your page takes less time to load and reduces the
number of HTTP requests sent to the server.

The WordPress community has built some good plugins that can compress and
combine JS and CSS individually, as well as collectively. Plugins such as WP Minify
and CSS Compressor allow you to compress and combine various JS and CSS files
into a single file.

Another method is to manually call JS/CSS and load data into PHP, via .htaccess. It is
imperative that you mention the Root Path. Through gzip compression, youre then
able to set header expiry and other cache related controls. Heres an example-































Webmasters usually take care of all the necessary tweaking, while paying little
attention to the WordPress core itself. This can have a long term impact on WordPress
performance and can slow it down drastically. Database cleaning ensures that no
clutter remains in your MySQL database.

Though it seems time consuming, getting your database to perform better is not as
difficult as it seems. While you can find many plugins, we at Cloudways prefer to
optimize the DB manually. This includes making sure that memory and processing
power of your server are both utilized at optimum level.
.htaccess Code
<FilesMatch "\.(js)">
ForceType application/x-httpd-php
//Absolute Root Path Required to Load PHP File
php_value auto_prepend_file "server/root/path/filename.php"
</FilesMatch>

.php Code
<?php
// initialize ob_gzhandler function to send + compress
data
ob_start ("ob_gzhandler");

// send the requisite header information and character
set
header ("content-type: text/js; charset: UTF-8");

// check cached credentials and reprocess accordingly
header ("cache-control: must-revalidate");

// set variable for duration of cached content
$offset = 7*24*60*60;

// set variable specifying format of expiration header
$expire = "expires: " . gmdate ("D, d M Y H:i:s", time() +
$offset) . " GMT";

// send cache expiration header to the client browser
header ($expire);
?>

High traffic sites need the server level caching to be set for performing at an optimum
level. This is both complex and time-consuming, and its better to get the help of an
experienced systems engineer. You might have heard about Varnish, Memcached,
and APC, which are excellent tools to boost performance substantially, however
implementing and tweaking them for the best performance according to your
infrastructure, needs the help of an expert.
Now, at the application level cache, WordPress can save static content locally, and
speed up access to data and conserve bandwidth. WordPress has pretty good plugins
that serves .html pages stored locally. W3 Total Cache and WP Super Cache (this
also does server side cache) are my personal favorites.

Enterprise level websites use multiple caching servers (also known as reverse-proxy
servers) such as nginx. Using nginx with plugins and PHP opcode cache can
significantly improve site performance.



Shared dorms are good in college life; not for hosting your business websites. Hosting
type and server configuration is critical for high performance. You need to properly
plan your infrastructure while keeping average concurrent visitors and unexpected
traffic hikes in consideration. Similarly in hosting, cloud servers provide the scalability
and reliability needed by enterprise websites. By giving a custom server environment
to your website, it allows seamless growth over the years.

If your site experiences heavy traffic, processing and network limitations must be kept
in mind before signing up with a host. A 5-6 GHz processor along with 5-6 GB of
memory is essential to handle 100 concurrent users, but it may vary according to your
requirements. Ask your service provider to help you in allocating resources.


Like JS and CSS, your images should be compressed as well. WordPress by default
compresses the image quality to 90%. Although photographers wont be much
interested in image compression, the majority of users can utilize plugins like WP
smush.it, which is pretty good with compressing and optimizing images. With
lossless compression, the images are optimized without degrading visual quality (for
the most part)


CSS sprites are almost used by every websites nowadays. They reduce the HTTP
requests made to the server by placing (and serving) numerous images onto a single
file. Visit http://bit.ly/fbsprite to see the one Facebook uses for its chat feature.

Most websites developed by professional web developers are made to be pretty darn
fast, but due to some decisions made in part due to business requirements, they end
up losing some of their ingredients for top performance.


It is a perception that if websites use caching properly, they don't need a CDN (Some
managed WordPress service providers even say so). Content Distribution Networks
reduce network latency and ensure that your site loads quickly no matter where your
visitors are located. A CDN distributes static content over multiple server locations
and redirects visitors the server.

Also, your server wont be hammered with a sudden traffic surge with a CDN in place.
However, like other caching plugins, CDN must be properly configured and regularly
updated. You can consult a WordPress expert to handle cache updating.












Cloudways Ltd. provides turnkey cloud architecture design, deployment and management solutions. Working with
leading cloud providers such as Amazon, Linode, CloudSigma and ElasticHosts, the company specializes in helping
small and medium enterprises (SMEs) design, deploy and manage custom cloud infrastructures.

Cloudways works with clients from various industries such as Healthcare, IT, fashion/apparel, advertising and enjoys a
high customer satisfaction rate of 94%.

Check out our "WordPress for Business" Interview series at our Blog: http://www.cloudways.com/blog/





Thanks for taking the time to read through the guide! As a token of appreciation, you can use the following code
to avail FREE WordPress site migration, setup and deployment at Cloudways.
You can use the code when youre requesting for a quote, or chatting with our presales engineers.

You might also like