Since a lot of people out there land on my personal website looking for help and assistance making really really fast websites, which rank well in Google, often I’m asked questions about how to make fast sites.

So strap in and get ready to roll with a description of how I made this one of the Fastest websites in the World! Yeehah!

If you’d like to make the fastest website in the World, how would you go about doing this?

Well, the short answer is, every single element needs to be 100% optimal.

I’ve been accused by some developers of practicing “micro-optimizations” which I take to be a compliment. Of course I practice this. Like a Forumla 1 engineer, optimal is a case of piling micro-optimization after micro-optimization on top of each other in order to achieve a stack of optimized machinery which, when all is added together, is as fast as it is possible to go.

So where to start?

Let’s begin at the beginning. I’m going to talk about hosting a PHP web application, like WordPress. You can use JS frameworks, or write plain HTML which is very fast. But the majority of businesses use a CMS, and the majority of people who use a CMS use WordPress, because it is stable and easy for less technical members to familiarise with. So let’s speed up the typical WordPress stack.

Fastest Website?

This website – robinjescott.com – loaded during testing in 0.2-0.313 seconds on home. This post’s URL loads in 0.35-0.47 seconds (tested via Pingdom) in London, UK. Load times globally will differ a little, but all elements are fully loaded in under 1 second in all test locations.

Google PageSpeed score is 92. Yslow score is 100.

This website runs the latest version of WordPress, and a child theme of the stock Twenty Nineteen theme. In short, you can be this fast.

WordPress is Fast, Secure & Ranks

  • Never been hacked – running WordPress.
  • Under 0.4 seconds fully loaded – running WordPress.
  • Ranked on the first page of Google results as “the fastest website in the World” – running WordPress.

Your Domain Nameservers and DNS

The nameservers you use to host your domain records, and the DNS records themselves matter in terms of speed.

There are two issues here: lag and server response time. There are other considerations here, too, such as TTL, which will tell all the various network caches around the world how long your domain DNS records are authoritative. Unless you are making regular changes to your DNS, and unless you have a particularly fast and globally available namesevers, you should set this to be pretty long, like 12 or 24 hours (or more).

My recommendation for your nameservers is to look at globally available service like AWS Route 53. These cost something like $0.50 a month to host all your domain’s DNS, but are blazing fast globally.

Set your domain @ records TTL to be 48 hours or longer if you don’t expect to change these – allow network level caching to do it’s thing.

Your Hosting Machine & Stack

There are a lot of elements to the hosting machine, but general rules apply, as well as some specifics.

For WordPress sites, I recommend either:

If your site is a PHP application running Magento or similar, I recommend to try your site on Cloudways – use Vultr.

Note if your site is WordPress with WooCommerce, have a look at the Best WooCommerce hosts here.

Don’t use Shared Hosting

If you are looking for optimal, do not use shared hosting. This is a recipe for disaster, because (and the clue is in the name) your site will share resources with others, leading to bottlenecks.

Use a VPS, Cloud Host or Dedicated Server

You want your resources dedicated to your instance. Which is best depends a little on the size, scaling requirement, and location of your hosting machine – all of which are debatable – and whether or not you need clustering or redundancy to be factored in.

Buy as much hardware as you can afford… but not more than you need

I often see people throwing hardware at sites in an effort to go faster. It doesn’t work like this. You need RAM and CPU to be sufficient, and there is a performance advantage to certain choices (like choosing SSD drives, or having more CPU cores for certain operations) but in a lot of cases, the hardware needs only to be sufficient. Big enough, and capable of holding the fastest software is sufficient here.

The Web Server – Nginx

Apache is slow. There, I’ve said it. It is also a very powerful and stable web server. In my opinion, Nginx should be taking the initial requests, however, and either serving directly, or caching apache’s slight slowness out of the mix.

Use PHP 7.3

The most recent version of PHP is faster than the last. It’s also more secure. But, you will likely need to refactor your code to be error free, particularly if you have code which is a few years old. Consider dropping support for older versions of PHP in your code, if you will never use them.

MySQL – Consider MariaDB 10 or MySQL 8

MySQL 8.0 is looking likely to be a real performance boost. Until this is regularly available, MariaDB 10 is a really fast alternative. Please note that conversion from MySQL 5.7+ to MariaDB is not straightforward, so you need to make a decision at this point (there are other ways to import data, but it is worth remembering to make your decision at MySQL 5.6 with this in mind).

There are other (somewhat political) reasons to make the MySQL vs MariaDB choice. I’ll not get into politics here, except if it impacts speed. MySQL 8.0 shows a moderate performance boost over all equivalents in my most recent benchmarking.

Look at your Code

Maybe I should have led with this. Slow performance is almost always a result of some code (or lots of code) in the system which does things the long way around. You need all the elements of your code to do things fast. Think fast first when you are choosing everything software related, including your theme and plugins if you use WordPress.

Got Questions – Leave them below

There’s obviously lots more I can add in here. If you’re interested to know more, see my long guide to optimizing WooCommerce for some granular stuff you could get into, or ask a question below.

I aim to build this section out more over time to become a working guide to the fastest possible stack for your PHP web applications.

Please ask and complain if you agree, disagree or want to know more.

Join the Conversation

14 Comments

  1. Please note, this piece is deliberately vague. I’m focussing on choices you will need to make, not technical solutions. There’s plenty of tutorials out there – I’ve posted a lot of them myself. This is a slightly wider view about what fast is, and how to get there.

  2. An interesting discussion is worth comment. I think that you should publish more about this subject, it may
    not be a taboo subject but generally folks don’t discuss such topics.
    To the next! Kind regards!!

      1. I love that you’ve written a wide approached article to building a fast site.

        I am obsessed with site speed and have found litespeed servers to be insanely fast…

        For example, i have litespeed server with litespeed cache partnered with cloudflare static caching cdn. In the UK on Chrome, Safari etc and on pingdom my site loads in just over half a second on the homepage….

        Not that impressive, but…

        My huge 11mb webpage on google algorithm updates loads in 0.6 seconds with the above stack;

        No VPS, just a decent cloud hosting in the UK.

        In the coming years and the move away from pc, page site speed is going to become ever more important for both UX and SEO.

        Mobile is substantially slower and thus, you need insanely fast desktop load times just to buffer then inevitable drop when a user visits a site on mobile.

        But yeah, i might be a little insane like you for page speed 🙂

        All the best,
        Adam

        1. Yeah Litespeed is usually better than Apache for speed. It generally performs a little slower than straight Nginx (and is also proprietary rather than open source too).

          Most people seem to compare Nginx + Apache with Litespeed, which is an unfavourable comparison.

          Compare it with a LEMP stack, with no Apache, and you’ll find Nginx is a clear winner.

    1. Hi Asif,

      Upgrading to PHP 7, wouldn’t “damage” your site, but some of your plugin or theme files might not be compatible, and this would cause an error, and in some cases, lead to a white screen (i.e. your site not working). You would want to check and resolve these errors BEFORE you upgraded.

      There’s a plugin called “PHP Compatibility Checker” which is in the WP repo (it’s made by WP Engine) which can help with this, or I would also recommend posting a task for a developer to test and confirm this before you make the switch, if you’re not comfortable with this.

  3. Forgot to mention…

    QUIC CLOUD (a litespeed cdn) is in beta currently that does both dynamic cdn caching (php etc) AND static cdn caching which is insanely fast….

    I have tested it and using lscache, litespeed server, and quic cdn (dynamic and static caching) is substantially faster than lscache, litespeed server, and cloudflare static.

    Give it try! My only recommendation is use it on test sites currently as it is in beta and i have experienced some bugs which have made me revert to cloudflare cdn until quic cloud is out of beta.

    All the best,
    Adam

Leave a comment

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