Knowledge Base

Articles list

CDN Instructions

Cloud Storage is often used for the mass distribution of content (graphics, CSS files, videos) 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 quickly downloaded from anywhere on the planet.

A CDN (content delivery network) is a geographically distributed network consisting of a single origin (primary) node and edge (caching) servers placed 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 stress 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 Link button.
    image
  3. The new window will display a list of file links.
    image
  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 .selcdn.com

The resulting printout will come from akamai.net:

...
;; ANSWER SECTION:
.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 .ru link access, enter the command:

dig .selcdn.ru

The resulting printout will come from selcdn.ru:

...
;; ANSWER SECTION:
.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 as ***-a.akamaihd.net

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

image

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

Usage

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

The first time an object is requested from the CDN, it will be loaded to the cache. Traffic for this request is billed as delivery from the origin. CDN traffic is billed separately.

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

Our price 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 query 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) processes 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), as 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.

image

On average, the cache is cleared in 5-7 seconds; however, in extreme cases, it may take up to 15 minutes.

Purging the CDN Cache from the 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.

Disabling the CDN

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