When people talk about optimization they usually focus on the front end. That means focusing on things like the HTML code, combining CSS files, deferring JavaScript files, and optimizing images. These are all very useful techniques but they're also the easiest techniques to implement.
It’s important to remember that hosting directly affects the initial page load. And it's worth investigating even if it is incredibly time-consuming and possibly expensive to change.
Visualize Your Hosting Speed
I just performed a speed test and if we look at our home page we can see that the page loaded in 2.1 seconds which is a very good time. (The rule of thumb is 3 seconds.)
So what part of this speed test is controlled by your hosting?
With a WordPress website your server processes all of your PHP files, creates an HTML page and then returns it to the user.
Your hosting settings directly affect this part. If you have more RAM, faster CPUs, or more PHP workers your server can stitch these PHP files together faster and return them to the user faster.
Confounding Factors
If you have a slow time to first byte (or TTFB) that doesn't necessarily mean your hosting is at fault. There are other factors that can slow down your TTFB.
All of this is affected by your theme, plugins, and settings. If you have a horribly slow plugin your TTFB could be 5 seconds – even on the best hosting on the planet.
Luckily there’s a trick you can do to test just the hosting aspect of your site. Instead of testing an actual page on your site test the already created HTML readme file which WordPress installs by default at YourSite.com/readme.html
Some hosts might not install the readme or it might be blocked. In that case, reach out to your host so you can test that readme file. Or create a simple HTML file yourself and upload it.
So let’s test the readme.
You can see that loading the readme.html file takes 232 milliseconds. And you’re hoping it’s 200 or less MS. If it’s more it just means your server is far away, or it just might be slow.
You can think of this as a baseline number. This is an already assembled HTML file your webserver is sending to the user. And if you use caching which we’ll talk about later in this series this is the fastest your webserver could deliver a cached page to a user.
This trick helps you see how fast your webserver can return a file. But there is still processing time you have to consider. Meaning some hosts have lots of PHP workers which can process lots of parallel information or some hosts have high RAM meaning they can process a request more quickly.
Finding Your Processing Time
With our home page speed test TTFB (397 ms) & readme file speed test TTFB (232 ms) we can find how much time our server spends putting all of the PHP files together. For my site, it takes the server an extra 165 milliseconds of processing time to assemble the home page over a static readme file.
This is a very good time. If you have a lot of plugins, or a complex theme or a slow server this could take a lot longer.
And if you’re unhappy with this number – the rest of the series will improve other aspects of your site but can’t improve this number. That’s why we’re starting here. If it's 300, 400, or 500 milliseconds you should look into getting better (or closer) hosting.
So I want to be clear there’s a lot of information you could consider for your website host and unless you test your exact site on each host you can’t know for sure how fast it will run on their infrastructure.