Why Is My Website Slow?

Why Is My Website Slow? featured image

This is a question we are asked by people on a regular basis: “Why is my website slow?” The answer provided here, since 2012, is generally speaking in a WordPress context – because we are WP specialists – but a lot of the rules will apply to really any website, particularly one which runs on a Linux, Apache, MySQL and PHP setup.

Please leave comments at the end, and remember, we will come back, add, update, and improve this item in future. This is the web, not a newspaper, and everything we do here can be improved. Open Source ftw 🙂

Site speed: why does it matter?

It is something that is becoming increasingly important in this “I want it now” world we live in, too, as people are prepared to wait only fractions of a second to be delivered the content they were looking for – slow websites risk seeing the little “x” hit before they ever get the chance to deliver their message!

Site speed & Google search engine rankings

Worse, search engines like Google know that slow websites are of less interest to the population at large, and so punish them with poor search engine rankings, making your slow website even less likely to reach that Google searcher you wanted to sell your products and services to.

Enough of the why, show me the how!

So what can be done about it? And, why is your website so slow?

Well, the answer is usually a combination of things (isn’t it always!). The main things that a website must do have to be considered. When a browser makes a call for a website, the following things take place (this is simplified!):

What’s happening (slowly!)?

  1. Browser asks network “what is at this domain address”;
  2. Network points to DNS server;
  3. DNS server routes request to web server;
  4. Web server renders page (if dynamic) and delivers HTML and files back to the browser;
  5. Information is rendered by user’s browser into the website you see before your eyes.

There are a lot of steps there, yet this can be achieved on websites Silicon Dales have set up in 0.3 seconds. How? By making each step of the way as streamlined as possible.

The simplest way for you to increase the speed of your pageloads is to make sure the file size is as low as possible – the information being transferred will exit your web server and enter your local machine faster if it is small.

Deflate all the things

Use Gzip or mod deflate to shrink HTML, JS, and CSS files.

Minify HTML, JS and CSS

Minify and remove whitespace wherever present to get rid of those unneccessary kilobytes.

Optimize your images

Optimize images to make them as small as possible, [and try to serve static content, like images, from a cookieless domain]. 2018 edit, this cookieless domain thing… it isn’t so important.

Choose and use a good CDN for static content

Also serve static files from a CDN (content distribution network) to allow multiple elements to download faster – browsers only download so many items from one location, so get things flying along in parallel by serving images, etc, from another domain.

What the heck is “static content”?!

Static content is the things in your site which are “downloaded” by browsers from files which do not change. Like JPG, GIF or PNG images, for example. Or CSS files or JS files. Ideally, CSS and JS would be combined into one, minified, file, and downloaded once, from a CDN!

Leverage browser caching

The above improvements to offloading static content make the initial pageload nice and zippy, but boy-oh-boy it can be lightening fast if the browser caches all the things in your page (like logos, CSS, JS and etc) for use on subsequent pageloads. Get your .htaccess (or Nginx conf – or even httpd.conf!) files sorted so that browsers can cache all the things, for as long as is sensible.

Find out how to leverage browser caching here.

Upgrade your web hosting server

Make your web server faster – by upgrading it – though this (expensive) resort should be a last one! Almost always, improving your hosting environment will lead to speed improvements.

We recommend moving up to a good Managed WordPress Host, if you are currently on a below $10 a month shared hosting package. This would be a great first step to a better, faster, WP site, right off the bat.

Move to PHP 7

Here’s a thing. Upgrading to PHP 7 will almost always speed up a PHP site from version 5.6. If you are on a version older than that… well, try not to be, and soon. 7.0 is good. 7.1 is better. 7.2 is the absolute bees knees and cats pyjamas to us (that is a colloquialism meaning really really great 🙂 ).

Not all code is ready for PHP7, though, so you will need to test it before you go. Maybe a plugin is holding you back. Consider ditching that plugin. Seriously. The benefit of moving to PHP7 is worth finding a replacement.

Install a caching plugin

If you are using WordPress, install and configure a good quality caching plugin. There are a few around. We like WP Rocket for ordinary users, though it should be noted a lot of managed WordPress hosts will “roll their own” caching solution. Not all of these are brilliant, in our (considered) view, but they will be better than “no caching at all” which is… slow.

Page caching is built into WordPress, but managing this well is a plugin’s job. Caching basically means saving the page content (in some way) so that is does not need to be pulled out of the database every. Single. Time. The exact same page is loaded. Its like handing out a business card to people (one you already printed) versus writing down your name and telephone number every time someone asks for it: way way faster!!

Think about your DNS and name servers – consider CloudFlare

If your visitors come from multiple countries and continents, consider hosting in the cloud, or co-location, to reduce network latency. Name resolution can be slow. If you serve a global audience, consider using a DNS and proxy caching service like CloudFlare to quickly service visitors on the other side of the globe. CloudFlare can also help with traffic spikes, security (a bit), and DDOS protection. Also, if your server does actually flake out, they can serve a cache. Its a nice – free, as in beer – option to quickly improve really any setup

Further optimizations and deeper gains

There are more steps that can be taken, but once you have done the above, you should notice some improvement. If you have major problems, and the above looks okay, you could have network issues – make sure your DNS is setup correctly, and, if it is, next consider moving hosts. Try something quick and cheap to setup like Amazon’s AWS to test, if your scripts and websites load quickly there, then your hosting could be the culprit.

Get Silicon Dales to Optimize your site!

We take all of the above steps – and more – for our clients, to make sure their mission critical business websites stay online, and render faster than the rest. Contact us today if you’d like Silicon Dales to review and quote for development on your existing business website.

Also see:

Leave a Reply

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

Silicon Dales