CDN Instructions

Cloud Storage is often used distribute massive amounts of content to a large global audience. This usually includes larger files, such as photos, audio and video files, print mock-ups, etc. Using a CDN, this content can be loaded quickly from anywhere on the planet.

A CDN (content delivery network) is a geographically distributed network consisting of an origin (primary) node and edge (caching) servers. While there is only one origin, there are multiple edge servers, oftentimes located all over the world.

When a user contacts the origin, the request is forwarded to the nearest edge. The user receives data from that edge, which shortens the network route and load times for the user.

The advantages of using a CDN are:

  • accelerated content delivery
  • reduced workloads on the origin server; all heavy content is transferred from caching servers
  • reduced expenses on infrastructure development

Enabling the CDN

To enable the CDN:

  1. Create a public container and upload your file.
  2. Open the file link by clicking the corresponding button.
  3. The new window will display a list of file links.
  4. Copy the CDN link by clicking Copy, and paste the link into your browser's address bar.

The file will be delivered to your computer from an Akamai edge server. The object will initially be loaded to the caching layer from Cloud Storage, but subsequent requests to this file will be processed directly from the cache.

You can check which server delievered your file by entering the following command into the console:

dig <your_subdomain>.selcdn.com

The resulting printout will come from akamai.net:

;; ANSWER SECTION:
<your_subdomain>.selcdn.com. 600 IN CNAME selectel.inst.mdc.edgesuite.net.
selectel.inst.mdc.edgesuite.net. 9730 IN CNAME a610.g.akamai.net.
a610.g.akamai.net. 6 IN A 188.43.75.98
a610.g.akamai.net. 6 IN A 188.43.75.96

To view communications from the .ru link, enter the command:

dig <your_subdomain>.selcdn.ru

The resulting printout will come from selcdn.ru:

;; ANSWER SECTION:
<your_subdomain>.selcdn.ru. 600 IN CNAME selcdn.ru.
selcdn.ru. 225 IN A 188.93.16.238
selcdn.ru. 225 IN A 188.93.16.237
selcdn.ru. 225 IN A 188.93.16.236
selcdn.ru. 225 IN A 188.93.16.235

Enabling CDN Shared SSL Certificates

If you want to distribute files from the CDN over https with a shared SSL certificate, you can submit a ticket:

  1. requesting the custom domain
  2. indicating which container the domain will be attached to
  3. indicating the prefix (***) or full domain in the format ***-a.akamaihd.net

Once the domain has been enabled, it will be shown in the Additional domains field in the control panel.

Likewise, to disable an additional domain, you must submit a request via ticket system.

Usage

In Cloud Storage under Usage, you can view billing and resource information for each element of the Cloud Storage CDN.

As we've already noted, the first time you request an object from the CDN, it will be loaded to the cache. Traffic for this request is billed as if the file were delivered from the origin. CDN traffic is billed separately.

Subsequent requests to the file will be handled directly by the edge servers, bypassing the origin server, and you will only be charged for CDN traffic.

Our resource calculator can be used to give you a detailed estimate of Cloud Storage costs.

CDN usage is billed according to the following model: When an object from Cloud Storage is requested at the caching layer, the object is searched for in the cache; the object name and querey parameters serve as the key. If the object is found, it's immediately returned and billing occurs for CDN traffic from the edge server. If the object is not found, then the origin server (Selectel Cloud Storage) performs the request. The object is returned to the requesting server, and billing occurs for a GET request and storage traffic to the caching layer. The object is then returned to the user and billing occurs for CDN traffic.

CDN billing information may be delayed (up to a week), due to the fact that billing data is based on data supplied by our partners.

Clearing the Cache

The CDN caches data for faster distribution. The cache updates once a day, but if you modify a file that should immediately go live, you can force a purge.

In Cloud Storage under Storage settings, you can enter the addresses of the content you want to purge from the CDN cache.

This can be done by entering the address you'd like to clear into the address block and clicking Purge cache.

The average time it takes the cache to purge is 5-7 seconds; however, in extreme cases, it may take up to 15 minutes.

Purge CDN Cache from API

To purge the CDN cache from the console, run the command:

curl -i -X PURGE https://api.selcdn.ru/v1/cdn -H "X-Auth-Token: $token" -d $'https://ххххх.selcdn.com/container1/file1'

The resulting printout will look as follows:

HTTP/1.1 200 OK
Date: Mon, 16 May 2016 09:45:15 GMT
Content-Length: 268
Content-Type: text/plain; charset=utf-8
{"estimatedSeconds": 5, "progressUri": "/ccu/v2/purges/e4561042-1b4a-11e6-9024-f3cf5304c77a", "purgeId": "e4561042-1b4a-11e6-9024-f3cf5304c77a", "supportId": "17PY1463391915374207-348128448", "httpStatus": 201, "detail": "Request accepted.", "pingAfterSeconds": 300}

Please note that the CDN will be cleared about 5-7 seconds after the request is executed.

Learn more about the Cloud Storage API.

Disable CDN

To disable the CDN, switch your container type from public to private, delete public links, and detach the custom domain.