Host Consolidation is one of the several "Delivery Optimizations" that PageCDN performs to make websites exceptionally fast by removing overhead introduced by years of advancement in web development. Lets first have a look at what that overhead is before diving into host consolidation technique introduced by PageCDN.
Domain Sharding is a very common approach to parallelize the resource delivery and to bypass browser's connection limit.
As per MDN Web Docs, "browsers limit the number of active connections for each domain. To enable concurrent downloads of assets exceeding that limit, domain sharding splits content across multiple subdomains. When multiple domains are used to serve multiple assets, browsers are able to download more resources simultaneously, resulting in a faster page load time and improved user experience.
The problem with domain sharding, in terms of performance, is the cost of extra DNS lookups for each domain and the overhead of establishing each TCP connection.
Incidental Domain Sharding
Modern websites load content from several different hosts. For example, websites load open source libraries from public CDNs, webfonts from external font CDN, website's files from private CDN, etc. This all is done in the hope of improving website's performance but adds other indirect costs and make the overall scenerio sub-optimal.
For example, the below code is copied from
<head> section of a website. It loads open
source content from 4 different CDNs. This is similar to domain sharding but done for slightly diffferent
<link href="favicon.png" rel="shortcut icon"> <link href="book.css" rel="stylesheet"> <link href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,600" rel="stylesheet"> <link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css" rel="stylesheet"> <link href="index.css" rel="stylesheet"> <link href="custom.css" rel="stylesheet"> <script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script> <script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
Cost of Domain Sharding
There are several problems with domain sharding technique. Domain sharding adds cost of extra DNS lookups for each domain and adds the overhead of establishing each TCP connection. In addition to this, domain sharding makes the entire setup complicated and less manageable, and adds more points of failure to an otherwise simple business website.
If a website loads files from multiple hosts like public CDNs, private CDN, Google or other Fonts CDN, hosted widget, etc, it makes the worst use of the content parallelization capabilities of HTTP/2. So, even if the host is HTTP/2 enabled, it is of no use here and browser still requests each resource over separate connection as shown in the above example. This extra work the browser has to do is reflected in decreased website performance on mobile devices.
Host Consolidation to the Rescue
HTTP/2 supports unlimited concurrent requests making domain sharding an obsolete requirement when HTTP/2 is enabled.
With HTTP/2, transfers can be parallelized over single connection. HTTP/2 is so important for the performance of a modern website that browser developers even recommend splitting large files to many small files (over HTTP/2 or HTTP/3) for certain client-side optimizations to fully work. Since HTTP/2 does not put any limit on maximum number of parallel requests, many smaller files can be delivered faster even without domain sharding.
Host consolidation is opposite to domain sharding. It is a technique used by PageCDN to speed up websites by combining more and more files over single host to leverage parallelization capabilities of HTTP/2 and HTTP/3. This removes the overhead of unnecessary DNS lookups and TCP connections and improves the overall user experience.
How Host Consolidation Works?
Here is how host consolidation works at PageCDN. Unlike other CDNs that create separate sub-domain for every
origin, PageCDN combines content from all origins and serves through
pagecdn.io, a single host.
This seems simple and basic, but it allows us to do a lot of tricks behind the scenes to improve performance
- PageCDN is not just a premium CDN. It is a free public CDN too, that hosts
hundreds of popular open source libraries for free. In addition, it hosts content for more than 10,000
WordPress plugins and over 2,000 WordPress themes that is accessible for free through our Easy Speedup plugin. When you use PageCDN to serve
both public and private content for your website, it makes sure that all your content gets delivered
through a single host
pagecdn.io. So, your visitors get a chance to avails the caches already created in their browser by PageCDN's public CDN when they were visiting other websites, without their browser incurring extra cost of DNS lookup or connection to 3rd party public CDN. The best part is that PageCDN integration tools do this Public-Private CDN switching automatically without affecting your normal work flow and you do not have to visit PageCDN website to search for open source libraries one by one.
- PageCDN allows you to collect content from multiple different origins. For example, you can pull content from your website(s), or from your private (or public) GitHub repo(s), from your S3 bucket, or you can upload content to push storage on PageCDN and use them all on a single website. You can even pull content from other CDNs. With this approach, you not only deliver all your content through single host but also apply separate performance profiles to every origin to make sure things work the best for your case. The end result is, files from all different origins gets delivered in parallel over a single connection.
- PageCDN takes things even further and supports shared CDN. Just like public CDN for a library like jQuery, shared CDN allows content owners to share private or commercial content with others. So, you can create a shared CDN for your files and share with friends or followers. If you are a theme or small CMS owner, you can use shared CDN to host your commercial content and share across all installations or websites that use your tools (for free or for a charge). All this goes without extra connection or DNS cost if those websites already use PageCDN for their content delivery, and files get delivered in parallel with other files needed by websites.
- PageCDN hosts Easy Fonts to parallelize delivery of fonts over the single connection that the browser uses to request other files from PageCDN. Easy Fonts is a library that makes using webfonts far easier and facilitates with rapid prototyping. It hosts all the fonts from Google Fonts repo and serves free of cost. This helps you save the unnecessary 2 DNS lookup and connections required to serve fonts and CSS over separate fonts CDN. WordPress websites can use Easy Speedup plugin to switch to Easy Fonts.
PageCDN is a website acceleration service and it goes to great length to make sure your website wastes minimum resources specially on mobile devices and loads super fast. It makes maximum use of HTTP/2 capabilities including parallel content delivery and Server Push. It also allows you to use highest Brotli compression level (q11) so that you can reduce the content size to extreme minimum. This Brotli:11 compression is enabled by default for free Public CDN. If you want to accelerate your website with PageCDN, start here.