While the web is supposed to function in a uniform manner regardless of where you access it from, it rarely lives up to those ideals. In the real world, pages are fast or slow depending on where you access them from. Some connections are fast, and some are slow. And while in general, closer servers are faster, it’s not always the case – in fact, you shouldn’t base your hosting solely on location.
So what’s the best solution here? How do we do everything we can to get our content in front of users in the fastest way possible?
The Ideal “Cloud” Scenario – Light Years Away
Let’s look at the best-case scenario – how content would load if we’re living in a perfect world.
- Your website is stored on multiple servers throughout the world
- Use requests the page
- The system delivers the page from the closest server regardless of end user location
- All your commonly used libraries are already stored in the user’s cache
As of now, none of the above scenarios are realistically possible for ordinary websites. Yes, there are some sophisticated architectures out there that use Google Cloud Compute and Amazon’s AWS services which use a distributed network to store multiple versions of your content around the world and serve them from there. But those architectures are amazingly complicated and require constant monitoring, are expensive, and I personally don’t think they’re viable.
In the real world, this is the most likely scenario:
- Your site end-user in one location
- User requests the page
- System delivers most content from a single location. Maybe some landing pages are stored separately on a CDN
- If you’re lucky, the user might have some existing libraries already in cache
Let’s go through these one by one.
Hosting your Site on Close Servers
NameHero recently opened a data center in the Netherlands. This is good news if your clients live in Europe and you want a server closer to them. In the US, there are two centers – one in Michigan, and the other in Arizona, allowing you to choose a data center depending on whether your clients live closer to the east or the west coast.
As far as server locations go, choosing one that’s closest to where your most valuable customers live is the best you can hope servers. When I was naive, I used to think that there must be some way to spread out my site geographically and have my dynamic content delivered by the server closest to my visitor. Unfortunately, that’s a pipe dream.
Store your Landing Pages on CDNs
The only time it’s worth storing your dynamic pages on a CDN, in my opinion, is for landing pages. Cloudflare has a nice feature where you can specify 3-page rules under the “free” tier. You can use some of them to create special rules to cache and server your “money” landing pages. Here’s an earlier tutorial I wrote on how to do this.
The rest of your site can be served directly from your origin server. But for those important “money” pages, I think it’s worth caching them separately.
Use a CDN for Static Files
For files that don’t change like images, JS, and CSS, the best practice is to use a CDN to speed things up. On NameHero, Cloudflare will do this for you automatically once you set it up. In general, I would use Cloudflare for all my static files. I might make an exception for jQuery, and serve it from a public library like Google because it’s render-blocking, and there’s a strong performance benefit for a user who already has it cached on their website.
In the end, optimizing web hosting is more of an art than it is a science. There are often competing considerations, and you need to figure out which ones matter most. Convenience or speed? Fragility and fast, or solid and slow?
But I feel the above tips can be utilized with no downsides to try and give you the best of both worlds.
I’m a NameHero team member, and an expert on WordPress and web hosting. I’ve been in this industry since 2008. I’ve also developed apps on Android and have written extensive tutorials on managing Linux servers. You can contact me on my website WP-Tweaks.com!