Debugging a CDN service
Let's look what you can do when you are trying to debug your CDN service.
DNS - dig is your friend
Let's assume that you have a CDN service with the following details.
- Service Domain - cdn.mycompany.com
- Service Identifier - 12345.r.cdnsun.net
Please note that the Service Identifier is a ready-to-use CDNsun's domain which serves your CDN content. If in addition you would like to use (custom) Service Domain for your CDN URLs then you need to add a CNAME record to your DNS configuration (instructions at Services/How-To). Use dig tool to find out whether the CNAME record is set up correctly. Please note that you can use dig tool from command line and also our dig online. Dig your Service Domain cdn.mycompany.com and check the result. You should see something similar to the following.
cdn.mycompany.com. 21599 IN CNAME 12345.r.cdnsun.net.
If you don't see the CNAME record in the dig result then your CNAME record is not set up correctly or is not yet propagated. Please note that changes in DNS configuration can take up 48 hours to propagate.
DNS Check Tool
Use our DNS check tool at Services/Tools and check your DNS easily.
Static Content - curl is your friend
Your origin content has to be accessible via HTTP or HTTPS protocol and it must return 200 status codes only. Please refer to Status Code Definitions for more details. Also please note that when you create a new CDN service it can take few minutes to propagate it to all CDN Locations, so don't worry if your CDN service does not show up immediately.
Let's assume that you can't access your CDN content located at the following URL.
Use curl to find out whether the same content on your origin returns 200 status code or not. Note that you can use curl from command line and also our curl online. An example of curl result follows.
curl -I http://mycompany.com/htdocs/images/image.jpeg HTTP/1.1 200 OK Date: Sun, 06 Jul 2014 07:22:43 GMT Server: Apache Last-Modified: Wed, 25 Jun 2014 03:00:28 GMT
If your origin content does not return 200 status code then please fix that on your origin server. Also please note that when you change settings on your origin then you may need to purge your CDN content as it has been cached with the old origin settings (HTTP headers). Please refer to Purging and prefetching a CDN content for more details.
Content Check Tool
Use our content check tool at Services/Tools and check your static CDN content easily.
RTMP Stream Content - RTMPDump is your friend
You can use Linux RTMPDump tool to check your origin and CDN streams. Please note that in the case of Video CDN services origin is your Origin Domain and in the case of Video Push CDN services origin is (CDNsun hosted) Origin Storage. In both cases use curl above to check content on Origin Domain or Origin Storage. In the case of Live CDN services origin is Origin (RTMP) URL (services with Pull publishing) or Publishing (RTMP) URL (services with Push publishing) and their backups. Please refer to Services/Settings for Origin URL and refer to Services/How-To for Publishing URL.
To check an RTMP stream located at the following URL
use the following command
rtmpdump -o output.mp4 --rtmp rtmp://12345.r.cdnsun.net/12345/_definst_/live
If the above stream is active then you should see something like
Connecting ... INFO: Connected... Starting download
as a part of RTMPDump output in your Linux terminal.
Content Check Tool
Use our content check tool at Services/Tools and check your CDN streams easily.
What happens to a CDN service when its origin fails?
Please note that it is recommend to use CDN Static Push rather than CDN Static Pull (and the same for CDN Video Pull/Push) because in the Push case CDNsun operates both CDN servers and origin server and thus if something goes wrong on origin then we can take action. In the Pull case when your origin server fails then it is up to you to detect it and correct it because we have no control over your server. Let's look what happens to a CDN service when its origin fails. The answer depends on the CDN service type.
- CDN Static Pull / Push - a high percentage of requests to your CDN service respond normally for some time. Good estimate for the percentage is your cache-hit ratio and the time closely corresponds to the cache expiry time of your content.
- CDN Video Pull / Push - the CDN service fails.
- CDN Live and CDN HTTP Live - the CDN service fails.
Read about the following topics.