Reasons to use the CDN service on the website
As a webmaster, you are always looking to speed up your website to increase your user satisfaction or user experience. One of the newest and most modern models of increasing site speed is currently using a CDN service. (CDN stands for Content Delivery Network or Content Distribution Network).
These services reduce the extra load from your site’s main server and increase the speed of content delivery to users, giving you and your users a better user experience in managing the website.
Today we want to introduce you to how CDNs work as well as why they are used and some additional benefits of CDNs. We also challenge you to judge the difference between using and not using a CDN by showing several speed tests before and after activating the CDN service.
40% of users leave a website if it loads for more than 3 seconds. (This is a global indicator, but in Iran, due to the very low speed of the Internet and the high volume of websites, this indicator is forecast for up to 7 seconds).
What is a Content Delivery Network (CDN)?
The word CDN stands for content delivery network, which means content delivery network. The service is a worldwide network of servers designed to host static (and sometimes dynamic) information on your website, such as images, videos, CSS files, and JavaScript files. Note that when we talk about hosting, we do not mean hosting a website like shared or dedicated hosts of your site. CDN is a completely separate hosting service. CDN services are not a substitute for your hosting, but they are an additional way to improve site speed.
How does the CDN service work?
How exactly does the CDN service work? Well, for example, when you want to buy a web hosting host, you have to choose the location of a physical data center like Germany, France, America, Iran and so on. For example, we chose France to host. This means, for example, that your website is hosted on servers located in Paris. Now consider that someone in Iran wants to enter our website and someone from France enters our website, due to the location of the server and also the transfer of data from the source to the destination country, the loading time of the website in Iran will be longer than in France. . This is what is called latency. A license is the time or delay required to transmit information over networks. Therefore, the farther the user is from the location of the website server, the higher the license.
Also do not forget the license in data exchange, when you as a user receive data and send the requested request to the server by filling out a form or clicking on a key, your distance from the server will still delay receiving a response. This is where the CDN comes into play, and at this time we are adding a service called CDN to our website to reduce the license. The CDN service displays information from the nearest server to the user, reducing the load on the website. CDN servers are sometimes called POPs. See this section for more information on how the CDN works with an example)
WordPress users initially show reluctance to use CDN. Here we teach you how to operate a CDN in 3 very simple steps as well as how to activate it on your website.
first stage :
Choose a CDN service provider and sign up for their website. Their service is mostly monthly or bandwidth volume, and most providers act intelligently to calculate the price and do not need to send a ticket or contact the provider.
second stage :
Use a free plugin like CDN Enabler or WP Rocket to integrate your CDN with WordPress. These plugins automatically merge your data with the CDN. With these plugins you do not need to do anything and everything is done automatically, only some basic information is needed to connect to the CDN. Using a CDN is now much easier than it was a few years ago.
third level :
Now when your users visit your website, the content of your WordPress website is now loaded on CDNs around the world and the nearest CDN server is selected according to the user’s location and the information is loaded for it. So if the user enters our website from Iran, he will no longer feel the previous license to transfer from France to Iran because information is sent to him from a server in Asia. Here we come to how CDN detects a user’s location. This server uses IP detection as well as geo-routing to detect the user’s current location to correctly identify the most accurate location and select the nearest server.
However, it is still important to choose a powerful server in a central location, because if you use a powerful CDN to load your website data, the browser will have to send a few requests to receive static files such as HTML and PHP, unless Use the proxy server storage technique, which is a separate section that we’ll cover later. At present, there are many hosting websites that operate in Iran in terms of providing powerful servers and serve from different parts of the world, including our own country, Iran.
Advantages of using a CDN
Below are a few of the many benefits of CDNs, and the size of the benefits of CDNs can be found at the link provided.
1 – Performance improvements
Improving performance is one of the most important reasons to use this service. With this service, every time you load the website, the service receives data from the nearest server with maximum speed and reduces the users bounce rate (You can read more about bouce rate in the article What is bounce rate, a detailed definition of Do not miss SEO teaching mentioned in the article) and find loyal visitors for you. And this does not mean a simple change in user experience. When was the last time you entered your website and the website loaded late? This is something you want to remember and always have a great speed to load the page. This speed is not easily achieved. Below we have prepared a reliable statistic of the greats of this industry that you should pay attention to:
- For every one second of delay in loading website data, you increase the loading time by 7%. (Source: Kissmetrics)
News networks lose 10% of their users per second due to low speeds. (Source: Creative Bloq) - More than 53% of your website’s mobile users will leave your website if it loads for more than 3 seconds. (Source: DoubleClick)
- AliExpress website reduced its website load time by 36%, increased its orders by 10.5% and also added 27% to the conversations between its users. (Source: Akamai)
All these problems and tips are possible by CDN.
Reduce TTFB
We mentioned earlier that connecting a CDN to your WordPress website will reduce your website’s licensing as users’ physical distance from the server decreases. It can also reduce the time it takes to get to the first byte of the website (TTFB or time to first byte).
In the simple definition of TTFB, the browser has to wait a while to get the first byte of website data. The longer this time, the slower the website will load. But we have an important suggestion for you, and that is that you must read the article What is TTFB to optimize the loading time of your site.
One misconception about calculating TTFB is that most people think that it is time for the browser to access the first byte of the website after checking the DNS, which is completely wrong. The TTFB latency depends on the quality of your website, and the lower your TTFB.
In general, loading the first byte on the website must go through 3 stages of processing, delay and licensing. The high TTFB on your website may be due to incorrect coding or misuse of the cache system. But user location is also one of the reasons. We tested the difference between active and inactive CDN in the TTFB of our website, and the result is as follows.
TTFB Website without CDN
We first performed a test without CDN activation, which showed the website load time of 1.45 seconds, of which 136 milliseconds were related to the website TTFB.
Note: If you are using CloudFlare, TTFB may take a little longer because it does not have a server in Stockholm. Also in Cloudflare your data is downloaded completely as a proxy from Cloudflare servers and may take longer due to additional benefits than the previous TTFB. Consider, too, that Cloudflare adds an additional firewall to your website to prevent brute-force attacks and other cyber-attacks, which can be one of the reasons TTFB time is increased.
So you have to challenge yourself which CDN to choose, the service that gives you the most benefits or the service that gives you better speed !! The choice is yours. If your website is not optimized properly, it may increase the TTFB of your website. If you are interested in using CloudFlare as a CDN, the company has recently introduced a new service called Argo, which has a huge impact on TTFB and helps reduce it. If you are interested in using Cloudflare, you can read the post on how to install Cloudflare, in this comprehensive post, we have reviewed this CDN and how to install it.
Faster delivery using cache system
Just like WordPress cache plugins, most CDNs use the ability to cache pages without putting pressure on your server. This will allow the user to load your website as soon as possible after the first visit to the website, given that some of the data is already stored. This is one of the best ways to speed up your site. One of the most important things you need to know right now is how the cache works. When the CDN receives your files, it sends the data to the user’s browser once or twice before caching it in the browser, and then stores it in the browser after receiving the complete data.
A CDN puts a section called X-Cache in the HTTP Header. In the first and second requests, this section is placed as Miss, which means unstretched.
In subsequent requests, it will show you the word HIT, which means the page is cached. This cache is cleared in various ways, for example some headers expire or manually.
If you are using a fully proxy CDN like CloudFlare, you can use a simple technique to move the cache system to the next step and cache the full screen. This will cache all the links on the website. Although, in WordPress websites, it is sometimes a problem that you have to find a solution for the dynamic parts of your website, but in general, it increases the speed a lot.
Great savings using Gzip compression
CDNs generally use Gzip compression to compress loaded files. Gzip is active on the server platform (or CDN platform) and reduces the size of your HTML, CSS and JavaScript pages. This method does not work for images that have been compressed in another way. Sometimes Gzip compression reduces data volume by up to 70%. This is probably one of the easiest speed optimizations you can enable for your website, and if you do not know, do not worry, this type of compression is enabled by default on all CDNs. You can use Check GZIP compression or similar tools to check if Gzip is active on your website.
For example, below you can see that the size of the jquery.js file has been reduced from 94.9 KB to 33.6 KB after compression, which is a 64.59% reduction in the size of a single file. By looking at your other files, you will realize how important and effective compression is.
Go to the next compression step with Brotli compression
Brotli compression is a new compression style developed by Google that can compress files up to 26% faster than Gzip. Brutley’s progress rate has increased so much since its introduction on June 20, 2017, to the point that video ads are also compressed using this method.
However, Brutley is a new method and is not supported by all CDNs, but very few CDN providers such as KeyCDN and CDN77 have so far announced support for this new method. In most cases, Brutli is enabled by your host and does not need to be activated, but if it is not enabled you must enable it. Also, all update browsers now support the Brutley method.
In any case, one good thing about activating Brutli with Gzip is that if all goes well and your server also supports Brutli but in the end the user browser does not support Brutli, the compression method will easily return to Gzip and Your website will not be harmed.
HTTP / 2
One of the most important and largest features of CDNs in optimizing file downloads is HTTP / 2. To enable HTTP / 2, you need to enable HTTPS. In the past, when you used HTTPS to secure your web ports, your website speed slowed down a lot, but now, fortunately, with HTTP / 2, this is still a problem.
2 – Reduce the cost of bandwidth
Another advantage of using a CDN is that it saves on resources such as CPU and Ram for your website, and this savings is directly related to your website bandwidth. This will save you money from having to spend too much bandwidth on your website. You can also save on bandwidth purchases.
What you want is to get rid of the extra costs and control your other expenses, which CDN will help you with by reducing your bandwidth a bit.
For example, below you can see that Cloudfler has reduced the website bandwidth by 69%, which has saved the webmaster 273 GB of traffic.
How much can you save this way? In Iranian hosts where the website has a very low bandwidth, this amount of storage can save up to 70,000 Tomans or more per month in your costs. So not only can you save money, you can have better performance around the world. In SEO teaching, we have had users who have saved several million tomans per year in bandwidth costs by using CDN.
Another way to reduce costs is to enable HotLink Protector. This way you can prevent your pictures and videos from being posted on other websites. Some of you may have heard of the Huffington Post’s great corruption. One of the authors of this website copied images from a news magazine called TheOatmeal, forcing the owner of TheOatmeal to spend more than $ 1,000 on his monthly bandwidth. Therefore, the administrator of this website (TheOatmeal) by changing the image links and replacing the image below with the links in the Huffington Post, caused the reputation of this website to be destroyed. So that’s why we say protect your hotlinks, otherwise Huffington has a lot of Iranian posts.
3 – High availability and scalability
One of the advantages of CDNs is their high accessibility and scalability. Because duplicate content is stored on CDN servers around the world, if one of the CDNs in your problem automatically connects to the nearest possible server, it will not make sense.
If you are hosted by a poor web host, CDN can keep your website alive in the face of minor downtime.
4 – Increase SEO
Since 2010, Google has added a new indicator to increase the site ranking in Google, and that is the indicator of the speed of your website. So from that date on, the faster your website is, the better your chances of getting higher rankings. Although there is no way to prove the addition of this index, but given that high speed affects the user experience, rest assured that this will affect the SEO of your website.
Brian Dean, as a comprehensive research, examined more than 1 million Internet domains considering Google’s speed and ranking, and this research has led to a positive result of the theory of the effect of speed on Google ranking. Although these experiments are only acceptable inductively, they are still not provable (I also taught you algebra 🙂), but rest assured that a high speed website helps Google rank that site a lot. Simply put, Google pays for the high speed of your website.
In addition to better rankings, the good speed that CDN builds for you also speeds up the indexing of images and articles by Google.
5 – Additional security
Most CDN providers use a feature to increase website security called Origin shields, which is a type of cloud firewall. This firewall protects your website against any DDOS attack, including targeting UPD and ICMP protocols, as well as SYN / ACK, DNS amplification, and Layer 7 attacks. Another great feature that users add is the Proxy feature, which protects the IP address of the website and somehow equips your website with a bulletproof vest.
To test the effectiveness of DDOS attacks on the website, we built a small site and sent it nearly 5 million download requests in 7 days. A website that consumed a maximum of 30 to 40 MB per day, after 7 days, reached an average of 15 to 19 GB per day. In Google Analytics, the percentage increase in consumption reached 4650%, which is not good for a website at all.
By activating the CDN and the firewall, we saw an immediate reduction in attacks and bandwidth consumption, and the problem of high consumption was completely solved.
So you can prevent these attacks for a small fee.
CDNs also have the ability to create secure token links that allow you to create expiration links that are deleted over time and no longer have access to the user.
CDN speed test
Instead of defining an additional CDN, let’s challenge it. We performed 5 speed tests with CDN and without CDN by Pingdom from 4 different locations each. Our physical server is located in the United States and Iowa. Note that when you want to test your website, you have to retry it several times to cache your media. As mentioned above, when X-Cache HTTP is displayed, you are shown the word HIT, and if it is not cached, the word MISS is displayed. If your website cache is not working properly, the CDN will not help your website much. Therefore, it is very important that your website cache is active and working properly first. You can use free SEO tools to test the speed of your site.
Result :
Now let’s look at the result of CDN activation and see how much CDN affects website speed.
- Dallas, Texas, USA: 8.11% load reduction time
- San Jose, California, USA: 33.02% reduction in load time
- Melbourne, Australia: 54.19% load reduction time
- Stockholm, Sweden: 54.7% load reduction time
As you can see, when the website loads when we select Dallas and San Jose for testing, it is a small decrease, and this is good, but when we look at Sweden and Australia, we get an extraordinary 54% result, and the reason is only because Is the geographical location of the test. The web server is in Iowa and does not require much travel to display files in Dallas and San Jose, so they are faster than Australia and Sweden. When we activated the CDN and performed the test, due to the availability of CDN servers in Australia and Sweden, the speed was greatly increased and the loading time was drastically reduced.
Now is the time to ask !! Do you want to reduce the speed of your website by 50% in the farthest place from the physical server of your website? The answer is no 😐
Do you really need a CDN?
We receive many questions through emails or comments from our users in SEO teaching, is it really necessary to activate the CDN service for our particular website? Experience has shown us that there are advantages to using a CDN service on any type of website. Just take a look at the benefits we mentioned above. The cost of activating the CDN service is the same and cheap for most providers (not for us Iranians) and many of them charge $ 0.04 per gigabyte. Popular providers also offer free services so that users who can not afford to buy commercial services can also use the CDN service. The popular Cloudflare provider, for example, initially offers its users completely free services. This is great for when you want to test your CDN service for the first time. Also keep in mind that currently more than 30% of successful Iranian websites are using the Cloudfler service, but not the free panel, but its paid panels, note that if you have an Iranian host panel Free Cloudfler is not recommended because the photo result will optimize the site speed.
Now consider, for example, managing a small store in Ahwaz. As a store manager, you do not care about customers outside of Ahvaz or Iran. At this point, you need to find out where the nearest server present to your CDN service provider is. If your web host is hosted in or near Ahwaz, but the nearest CDN server is located in the UAE, then using the CDN service is wrong because it slows down your website. In this very rare situation, not using the CDN service is more of an advantage for you than using it.
Famous CDN Providers
There are so many good CDNs in the world right now that you can choose from depending on the possibilities they offer. Most of them will give you free features for a few days, so we suggest you try each one you like first and pay for its activation if you are satisfied with its performance. Here are some popular CDN service providers and then how to enable CDN service in WordPress:
- KeyCDN
- Cloudflare
- StackPath (formerly known as MaxCDN)
- CDN77
- Amazon CloudFront
- Fastly
- Incapsula
- Akamai
- arvandcloud (Iranian CD)
If you are looking for more explanation and experience about these CDNs above, you can read this section.
Install CDNs in WordPress
Each CDN provider has its own way of integrating and installing, but fortunately they all support WordPress and integrate very easily with it. Please follow our trainings step by step and if you have any problems, share them with the SEO teaching team. Also, for the convenience of your work, because more than 80% of Iranian users go to Cloudflare, we have prepared a comprehensive tutorial on installing the Cloudflare system on WordPress, which you can also read.
One of the things we recommend using on your website is to use subdomains instead of random structures. For example: CDN.yoursite.com. This will allow you to have your own branding in the CDN service and also not have problems in the data index by Google, which is very effective in SEO in this regard. After activating the CDN service on the provider’s website, you can use a free plugin called CDN enabler to activate the CDN service on your website to easily integrate all your information with the CDN.
Other plugins you can use to activate the CDN service are the WP Rocket plugin and the W3 Total Cache plugin, which integrate the CDN service with the WordPress website alike.
It is very important that you display the data through WordPress as much as you can. This ensures fast data delivery to visitors and the use of a unique HTTP / 2 connection. You can check your website with a tool like PingDom to see where each of your data is loading. Sometimes your skins and some of your plugins may load later because the CDN did not load them when they were loaded and they are loaded from the source server.
Finally, to ensure that the images loaded on the CDN service are indexed in Google, for users who use the Yoast Seo plugin for their website SEO, it is enough to copy the following code in the Functions.php section of their skin and the domain name and Replace your CDN subdomain name.
function wpseo_cdn_filter( $uri ) {
return str_replace( ‘http://yourdomain.com’, ‘http://cdn.yourdomain.com’, $uri );
}
add_filter( ‘wpseo_xml_sitemap_img_src’, ‘wpseo_cdn_filter’ );
If you do not do this because Google does not recognize your CDN service, it will not load images loaded by the CDN service either. You can use Google Search Console to check your index in WordPress.
Summary
I hope you now enjoy all the amazing benefits of using the CDN service on your website and enjoy the new loading speed of your website. This service helps you load your data around the world quickly, reduce your TTFB time, and dramatically reduce your bandwidth costs. In addition, with excellent loading speed, you can get a better ranking in search results because site speed is one of the key factors in SEO. And most importantly, your users will experience a great user experience.