Promoting a website worldwide is a story of its own. You can add translate everything, start launching advertisements and then find out that the website loads way too slow for the foreign customers. And sometimes it just doesn’t load at all, leaving them with an error page.
The reason for this lies in the very foundation of the internet.
World Wide Web
Internet is called a web for a reason. It doesn’t have a defined center that contains every website in the world. Instead, internet consists of a multitude of knots — servers — that connect with the threads of the broadband and optic cables. Websites are located on those servers.
But how does the internet know what server to look for a picture I want to see? How can you find the knot you need in the whole world wide web?
There are special DNS-servers to help figure out to which server to route the requests. Each server has a unique IP-address. It consists of four groups of digits, from one to three digit in each group, and is used to identify the server. Each IP links to the number of domains, such as google.com or yahoo.com.
You can even go to the websites using those IP addresses. For example, https://18.104.22.168 is a domain of Facebook.com. But to make it easier to remember the website, the domains are used.
Hosting companies, that rent domains and servers for the websites, create the corresponding records on their DNS servers. Local internet providers gather data from them and send it to their DNS servers.
Here’s how it works in real life:
- Californian student Michael opens his browser and inputs https://facebook.com in the address bar.
- Michael’s computer sends a request to local provider’s DNS server. The server defines, that https://facebook.com belongs to a server with an IP address of 22.214.171.124 and there is no such server on the internal network.
- The provider’s server sends the request up the chain, to the national provider’s server (AT&T, Comcast, etc.). That one locates the server with the IP address 126.96.36.199 in Miami.
- The national provider sends the request to the server in Miami, which then routes it to the local datacenter. There it is processed and the Facebook login page is sent to Michael’s computer via the same route.
All of this happens in less than a second. Michael hasn’t even finished his sip of coffee and the page is already loaded. But what happens if it’s not Michael from California? What if it’s Ivan from Russia?
Before Ivan’s request even reaches the US, it has to go through:
- A server of Ivan’s local internet provider.
- A server of Ivan’s regional internet provider.
- A server of the national provider (Rostelecom).
- A whole chain of Europe-located servers that will send Ivan’s request to the transatlantic transmitter.
- The actual transmitter, that will send Ivan’s request over the Atlantic using the submarine cable.
As a result, Ivan gets the Facebook’s login page not in one second, but roughly in three. And that’s if the channels are relatively free. If one of them is overloaded, it may take 10-20 seconds. The requests that are delayed for 30 seconds or more are automatically denied in order not to overload the servers.
The only way to make the websites equally fast for everyone is to locate a server with a copy of the website in each country of the world. Which is absolutely impossible, when you consider how much manpower you will need to maintain and update each of them regularly.
But there’s a solution — content distribution networks (CDN).
How do the CDN work
In order to understand the mechanics of CDN, you need to know what the websites are made of. Each website’s content can be divided in two categories — static and dynamic.
Dynamic content is generated by the website and its applications on the go. If it is a one-time generation, CDN will cache its results. If it is constantly updated in real time, CDN will request it directly from the server.
Out of all CDNs, I highly recommend Cloudflare. Besides caching the websites, it protects them from DDoS attacks with a smart routing system.
What is smart routing
A request from a user to the website can use different routes. For example, a request from Russia to US can go through Ukraine, Poland, Germany, Netherlands and Britain. Alternatively, it can go through Sweden, Germany and France. And the more servers it has to go through, the longer the response time is.
You can see the map of the internet connections at Telegeography. Admittedly, it is a little dated by now, but it should be enough to gain a perspective.
When the user requests dynamic content from the website that is connected to the Cloudflare, the data is sent using the high-speed channels that belong to the CDN itself or its partners. Before the transmission begins, the system calculates the fastest route. But all of this happens only if the request is validated and proven to belong to a real user — and not a part of a DDoS attack.
How does Cloudflare protect from DDoS attacks
If the website with Cloudflare gets a request, the system analyzes the history of the device that had sent this request on the other CloudFlare-connected websites.
- If there is a chance that it is a part of the DDoS attack, then the request is denied.
- If the request comes from a bot or a crawler (an automatic information collector) its bandwidth to the website gets limited.
- If the request is sent by a regular user, he gets the cached copy of the website’s static content, while the request for the dynamic content is being sent.
Besides that, Cloudflare offers some other, premium solutions. Little is known about the mechanics of their work, but the fact that they do work has been proven. Cloudflare has withstood even the most complicated attacks from the professional hacker groups.
How to install Cloudflare on the WordPress website
Installing Cloudflare on WordPress is easy. First of all, you need a create a CloudFlare account.
How to create a Cloudflare account
- Go to the CloudFlare registration page. Enter your email and create a password. Check the I agree… field. Click Create Account.
- Enter your website address in Add a website field. Click Scan DNS Records.
- CloudFlare will scan your domain and show you the recommended settings. DNS records that will be protected by Cloudflare, will be marked with orange cloud. Those that won’t be — with grey. You can click on the marks to turn protection on and off. Once you are done — click Continue at the bottom of the page.
- If some of your DNS records are not listed — add them. In order to do this, fill in the fields above the table and click Add Record.
- Select the plan and click Continue.
- Cloudflare will give you new DNS addresses, to which you’ll have to transfer your domain.
- Go into your Cloudflare account and click View API Key under Global API Key. Save the API key it gives you.
- Now you need to change the DNS records to the ones you’ve received in the step 5. If you purchased the domain at Unihost, you can use the manual in Unihost’s Knowledge Base.
If you purchased it somewhere else, then contact your hosting’s support team.
How to setup CloudFlare for WordPress
After you have setup the DNS, you need to optimize the caching settings for the Cloudlare. In WordPress you can do this via the official Cloudflare plugin.
- Log into WordPress.
- Click Plugins.
- Click Add New.
- In the Search field, enter Cloudflare.
- Find this plugin in the search results. Click Install Now.
- Wait until the installation is over and click Activate.
- Go to Settings > Cloudflare.
- Click on here
- Enter your Cloudflare email and the API key. Click Save API Credentials.
- Click Apply, to enable the Cloudflare recommended settings. Also click Enable, to allow Cloudflare to handle your cache automatically.
- Once Cloudflare asks if you are sure that you want automatic cache handling enabled, click I’m sure.
Cloudflare is not a magic wand that will solve all your problems. It won’t help, if your hosting is bad or your website is unoptimized. But if you need to speed up the website loading for your foreign customers — Cloudflare is the best solution.
Subscribe to get useful articles and updates.