Advanced Techniques to Push Your Website Loading Speed to the Limit

The need for speed. Although the quote is something typically associated with cars, the web also has a need for speed. Users do not only demand that sites load quickly, many users report they start getting annoyed when a site takes more than 3 seconds to load.

If your site takes more than 8 seconds of react to the input of a user, they will abandon the site, never to return. You will have lost a client forever.

Besides the user experience of the user, there’s another visitor which demands that your website is fast – Google. Website loading speed is actually a ranking factor, sites which are not fast get penalized in organic rankings when compared to sites which load fast.

But you probably already know all of this, in fact, there are hundreds of articles about making websites load faster, even on this site.

But, we’re going to go above and beyond all of that. We’re now going to shift up a gear and mention a few advanced techniques which will take your website loading speed to the next level.

1. Host your site on a Virtual Private Server (or better)

Hosting your website on a VPS (or virtual private server), is the first and easiest thing you need to do to make your website load faster. It’s not very advanced, and it’s not particularly cutting edge, but it’s essential nonetheless.

There are multiple reasons for this.

First amongst these is that most hosting accounts are focused on being profitable to the company who is providing the service, rather than on the performance of the sites which are being hosted on them.

Improve Website Loading Speed

The concept of hosting is that you take a few physical servers and put hundreds or even thousands of websites on them in such a way as to make a profit.

Let’s run some numbers to explain this.

Let’s say a physical server costs a $1000/month for the hosting company and a shared hosting account is priced at $5 per month.

The hosting server needs to host 200 websites ($5 * 200 = $1000) just to break even. It needs 240 sites it make a profit of $200 per month on that server.

So a shared hosting account is sharing the resources of the server with 240 other websites, and your website is competing for resources with ALL those websites.

Since you have no control over any of these websites, your site is more than likely running slow through no fault of your own, but because there are other sites using the server.

While the numbers above may not be exact, the concept behind it is real.

A virtual private server is very different. It typically costs about 5 to 10 times more than a shared hosting server, so the hosting company requires less “clients” to justify and make a profit in that server.

But for a company running a business via their website, why would you bother being stingy on a few measly dollars per month? What’s the real difference to the bottom line between paying $4.95 than paying $29.95 per month? It’s not going to break the bank is it?

Besides, VPS accounts typically have dedicated resources to each account. In essence, these resources such as memory and CPU time on the server are reserved for your website and your website alone.

This means no other account can use the resources of your account, even if your website does not have any users right now and is not using those resources.

This allows each account to execute much faster in general and websites hosted on VPS are typically several seconds faster than those hosted on shared accounts.

You’ll find that many services offer free upgrades with their virtual private server accounts, such as integration with a CDN or advanced website security services through 3rd parties such as Incapsula and support for HTTP2, as part of the hosting account or at a small additional fee – all of which ensure the smooth running of your site.

Improve Website Loading Speed

Even more important, with a VPS, the client has full access to the configuration of the server software running their website, with full administrative rights on those resources dedicated to their account.

So first things first, upgrade your shared hosting account to a virtual private server, or even a dedicated server, if you have the budget for it.

This is something which is important for the next techniques we’re going to mention to below, because most of them will require access to WHM or administrative access to your server.

2. Upgrade your MySQL database to latest versions or MariaDB

If you are running a WordPress or other CMS or database-driven site, chances are, your website is using MySQL as it’s database backend.

This is because MySQL comes pre-installed on most hosting accounts by default.

However, most people aren’t aware that the default version of MySQL installed on most accounts is quite old, sometimes verging on the obsolete. It’s also not very fast, when compared to other technologies which have been optimized for speed.

And what most people also don’t know, that there is an equivalent database engine which can easily replace MySQL, while also giving a boost in website speed.

This is the MariaDB database engine. It’s actually created by the original developers of MySQL and so you can imagine that they would want to make this 100% exchangeable with MySQL.

Improve Website Loading Speed

Infact, notable companies who make use of this fast database engine for their infrastructure include, Wikipedia, Google and even!

Even if you don’t upgrade to MariaDB, do upgrade to the latest version of MySQL. The latest versions of the software are always faster and more efficient than older versions.

Upgrading of course is not for the faint of heart, it is an inherently risky procedure and you need to have backups you can restore to in case of things not working out well.

It also requires you to have ROOT access to your server or VPS, which is the reason why we mentioned that you need to upgrade to a VPS or dedicated server.

To do this, (after you’ve taken a full VM backup), log in to WHM.

Go to Home >> Software >> MySQL/MariaDB Upgrade.

There is then a simple wizard which you can follow to automatically perform the upgrade.

Improve Website Loading Speed

3. Upgrade to the latest version of PHP7

Just like we mentioned before, you’ll find that the default version of PHP setup with most hosting accounts is not the fastest.

For example, if your hosting defaults to a version of PHP5.6, this has been out of active support for some years now (January 2017).

Even support for version 7.0 is at end of support since December of 2017 with the current supported version being version 7.2.

Yet for legacy reasons, most hosting accounts will still be defaulting to these older versions of PHP – but in reality, PHP7.2 is an extremely fast engine!

Improve Website Loading Speed

Any good hosting service should allow you to make 7.2 the engine used for your sites. If it’s not available for you, it’s probably time to switch your service to a better one!

Of course, always make sure you check that the software which your website is running is compatible with this version of PHP. If things break when you upgrade, you’ll need to check back with the specific vendor to ensure there is a fix or workaround, or maybe there is a version which you need to update to.

4. Set up OpCache for PHP

You’ve probably read over and over again that you need to implement browser caching for your site such as by following the article here, and also implement a file caching mechanism which actually creates a copy of your website so they can get served quickly.

But there is a 3rd level of caching you might not be aware of, but is the possibly the one which is able to take your server response time to less than half a second.

This is bytecode caching and is meant to make the actual execution of PHP faster. The way that PHP works is by compiling scripts into opcodes which are executed.

The opcodes are generated each time the PHP code is executed. What this means is that if the PHP code does not change, the generation to opcodes is a waste of time and resources.

Bytecode caching saves time by storing the opcodes in memory and once the PHP needs to be executed, the compiled code is fetched from memory and executed immediately.

This makes the execution of that PHP code lightning fast. Combine this with a VPS, running on an upgraded database server and file-level caching of your WordPress site or CMS and the server response time is typically within 200 to 400ms.

More importantly, such server response time is a measure which is typically thought of as the measurement Google uses as a ranking factor (TTFB), so boosting this response time is a big deal.

There are various ways to enable this, we found that the best way to do this for our setup was to enable a configuration under EasyApache4 which contains OpCache and then setting up the settings accordingly.

Improve Website Loading Speed

5. Opt for Nginx instead of Apache

Our final recommendation is a bit drastic and requires quite a lot of changes, yet given that we’re discussing advanced techniques, we cannot leave this one out.

Apache has been the standard web server for hosting sites for literally decades, but it’s popularity has been declining over the years, mainly because of one strong competitor – Nginx.

Improve Website Loading Speed

This web server has been steadily increasing in popularity, primarily because it is able to outperform Apache, particularly for very busy sites, which need to be able to optimize every aspect of their infrastructure. Nginx typically outperforms Apache when it comes to concurrent connections, meaning is it able to serve more users simultaneously than Apache.

Although Nginx has not taken over Apache in terms of the total number of websites using the server, it has significantly outperformed Apache in the top 10,000 websites on the web, with Nginx powering more than 60% of sites, contrary to Apache which hosts less than 20%.

Given the aspect of how Nginx is able to outperform Apache when it comes to concurrent connections, it makes a lot of sense that the top 10,000 sites, which are typically serving hundreds or even thousands each minute, it is no wonder that Nginx is taking over.

So if your site needs to multiple connections efficiently, Nginx is the logical conclusion.

Of course, switching from Apache to Nginx, if your infrastructure is already set up, is not for the faint of heart.

You’ll need to

  1. Verify that all your software is fully compatible with Nginx
  2. Install Nginx and any additional modules your site requires
  3. Switch all configurations and tuning for Apache to Nginx (the way they are configured is different)
  4. Implement any performance tuning necessary to push the server to the limit

The easiest way to set up Nginx on CPanel and WHM is using a module called Engintron.

Wrapping up

The above techniques are not for the faint of heart. They need careful consideration and a whole process needs to be in place to make sure you’ve tested your site for any issues which could occur by performing such drastic changes. But once you implement most of the changes above, you’ll easily be able to take your site loading time to less than 2 seconds. And when you do, you’ll see benefits coming with a few months, with better bounce rates, better rankings and most importantly happier clients!

Like the article? Share it.

LinkedIn Pinterest

Leave a Comment Yourself

Your email address will not be published. Required fields are marked *