CDN Infrastructure

The CDN infrastructure works with any provider as it would cache the data of the website regardless of the source. It works by pointing your website to the assigned CDN IP, you would also submit your existing IP address from your provider so that the data can be cached into the CDN upon the website being updated.

cdn_infrastructure
https://mysuperweb.co.uk CDN IP Backend IP

As we can see, when you request the website, it will go to the CDN IP. From the CDN IP it will access all the points of presence for the website, it will determine where is the closest location to serve the content.

If the content is within the CDN then it will return from the CDN itself, if the content has changed from the last cache, it will retrieve the latest copy from the backend.

HTTP/1.1 200 OK
Set-Cookie: OVHCDN=R2163828191; path=/; expires=Mon, 13-Jul-2015 10:33:05 GMT
Content-Type: text/html; charset=UTF-8
X-Pingback: http://mysuperweb.co.uk/xmlrpc.php
Cache-Control: max-age=2592000
Expires: Sun, 09 Aug 2015 22:08:44 GMT
Vary: Accept-Encoding
Content-Length: 23556
Accept-Ranges: bytes
Date: Fri, 10 Jul 2015 22:25:07 GMT
Connection: keep-alive
X-Cacheable: Matched cache
X-CDN-Geo: lon
X-CDN-Geo-IP: 46.105.196.69
X-CDN-Any-IP: 46.105.200.237

Here is the header for website where by the closest point of presence was London. If we was to test another location such as France, we should see a different point of presence.

HTTP/1.1 200 OK
Set-Cookie: OVHCDN=R2163932735; path=/; expires=Mon, 13-Jul-2015 10:25:19 GMT
Content-Type: text/html; charset=UTF-8
X-Pingback: http://mysuperweb.co.uk/xmlrpc.php
Cache-Control: max-age=2592000
Expires: Sun, 09 Aug 2015 22:26:37 GMT
Vary: Accept-Encoding
Content-Length: 23655
Accept-Ranges: bytes
Date: Fri, 10 Jul 2015 22:26:38 GMT
Connection: keep-alive
X-Cacheable: Cacheable
X-CDN-Geo: par
X-CDN-Geo-IP: 46.105.197.5
X-CDN-Any-IP: 46.105.200.237

Here we can see the CDN location is based in Paris when we are accessing the website within France.

Cacheable means that the content isn’t within the CDN and this is the first request on the CDN itself.

We can also check the CDN if we make a reqeust to the website in Canada.

HTTP/1.1 200 OK
Content-Type: text/html; charset=UTF-8
X-Pingback: http://mysuperweb.co.uk/xmlrpc.php
Cache-Control: max-age=2592000
Expires: Mon, 10 Aug 2015 08:59:31 GMT
Vary: Accept-Encoding
Content-Length: 23655
Accept-Ranges: bytes
Date: Sat, 11 Jul 2015 08:59:31 GMT
Connection: keep-alive
X-Cacheable: Cacheable
X-CDN-Geo: nwk
X-CDN-Geo-IP: 46.105.194.5
X-CDN-Any-IP: 46.105.200.237

We can also see the CDN working from the CDN network graphs:

cdn_infrastructure_traffic

To further enhance the CDN, you can also specify the TTL for each object type, where by .css files will be cached for longer periods and image files would have a different cache TTL from the .css files.