- The system of traffic counting is based on 95% algorithm
- How to start your work with video CDN
- How to start your work with pixCDN
The system of traffic counting is based on 95% algorithm.
Traffic and bandwidth readings are reported with 5 minutes intervals. In this way, there are ultimately 8640 readings as a result of this procedure (on condition that there are 30 days in the month). Select 5% of peak parameters that make 432 readings and exclude them from the list. You should determine the highest point from the rest 8208 readings. This is the value that affects the provider’s fee for the traffic. If, let us say, 5% of your readings make 10 Mb, 1 reading from the rest is 8 Mb and the rest readings make 3 Mb in general then you will have to pay for 8 Mb. We excluded 5% (or 10 Megabits) and selected the peak value from the rest. It is 8 Mb. As you see, this system of calculation is profitable to all who get steady traffic during the whole month. If you have surges of traffic (for instance, you bought traffic and 4 days a month people are directed to your website), then this method of traffic calculation will not be that beneficial and will experience an unpleasant surprise upon the bill receipt.
How to start your work with video CDN
What data needed to start using CDN.
To begin setting up, please, be ready answer a few questions.
Where are the video files located? They must be imported. How to change the structure of folders (such as add all the files in one etc), or leave as it is?
What rate of return setting register? Commonly used recoil velocity of about 120% of the bit rate and buffer size (the first N bytes are given no speed limit, so fast does not brake) in 3-5 seconds. It is possible and does not limit the speed. You can also specify the settings directly in Urla.
What settings should we do for hotlink protection? You can check the referrer (need a list), you can sign the URL (I will give an example of code signatures) you can optionally specify a lifetime un (s) for which the signature is valid, and the max number of ipov that can use this URL) or check and Ref and signature, or no way to defend themselves.
What file formats (3gp, mp4, wmv, etc)
What is average bandwidth
What is total amount of data
1. General vide CDN questions.
Our CDN serves only video files, for thumbs we usually use another type of CDN.
CDN for video works using 302 "Moved temporarily" redirect. Video files are stored on our servers. The amount of copies of each file depends on popularity of this file - more copies for more popular files, less copies for unpopular. First of all the request directed to the special server named Redirector. We have several Redirectors, and the domain hosted on CDN can be pointed on several IPs of Redirectors. When Redirector receives request it performs checkups of file's availability, permissions (referrer+URL key) and then returns 302 "Moved Temporarily" redirect to Streaming server which will serve this request and will put the file to the Surfer directly. Redirector chooses defined Streaming server depending on Streaming servers' load and their uplinks load, also depending on ping to the Surfer.
So, a separate domain needed for CDN, this domain should be pointed to addresses of Redirectors in DNS (address can be one, but we use several addresses for failsafe purposes and also for load distribution).
We have auxiliary scripts for automation of new files' addition. On the Customer's source storage server (where we get files from) two services should work: 1) HTTP-server for downloading of files; 2) rsync-server for getting of recursive directory listing..
At the beginning we import all files to CDN, the import is performed using web-form and POST-request to it. We send to the database a list with URL of file, its internal name in CDN, also some optional parameters like a size of file, a checksum, etc. Then CDN downloads files to our servers and after this files will be accessible via web (e.g. ready to use). After the successful import file can be removed from Customer's source storage server
We can save or modify the structure of directories, we store files on Streaming servers with original name but without directory, the directory is used only on redirectors.
We can change once imported file on fly,no need to delete file and reupload it, or upload it using another name. .
Here is an example or rsync config (rsync is used for automated addition of new files)
path = /home/client/videos.domain.com
comment = videos
list = false
hosts allow = 184.108.40.206 220.127.116.11 127.0.0.1
2.The best hotlink protection on the market.
There are several possible security from hotlinking settings:
Now the Cookie can be checked additionaly (you can choose any name). If its value matches the key value - the request is valid, even if there is no IP binding or no ref (if there is a ref but the values does not match - the request will be rejected). If there is no IP binding, missing the proper coockie will reject the request unless there is a valid ref.
In short - any of these three checks (for the correct IP, coockie or referrer) is enough for the request to be accepted and processed. Hotlink can not fake any of these parameters
3. Callback URL.
There is an ability to specify callback URL, which will be executed each time when file successfully imported or not imported with some error. This URL used to let Customer's script know that file is ready to use.
Callback URL is optional, it returns status of import in parameters: '?status=(fail|success)&message=Some message'. e.g. for example with callback: http://www.domain.com/cdn_callback.php?file=/0772/10100.flv should be executed: http://www.domain.com/cdn_callback.php?file=/0772/10100.flv&status=success or http://www.domain.com/cdn_callback.php?file=/0772/10100.flv&status=fail&message=404%20error in case of error
How to start your work with pixCDN
1. Creation of the source..
If you want to switch your website to a CDN, you should go to the admin area(http://pixcp.ahcdn.com/)to the section Sources (http://pixcp.ahcdn.com/en/sources?switchlang=1) and press the button “Add source”.
One should enter the domain name in the field “Source”*. Our system will import images and other static files to our CDN (without hhtp:// in the beginning and / at the end – only domain name).
If you want to use your domain name for CDN delivery then you should point it in the field “CNAME” (you should create DNS-registration for it, pointing to the domain name from the field “fetch name” as CNAME).
For activation of anti-hotlink you should specify at least one “REFERER:”. When the function of anti-hotlink is on, the files are distributed only if referrer is allowed, empty or blocked.
It can be used when the status of the source changes from “new” to “active”.
For instance, you pointed example.com as a source, CDN example.com as CNAME (and created, correspondingly, the CNAME note in the DNS). Then you can change the URL of images in the tag img in order to start showing images from CDN.
2. Cache clearing and mass files deletion.
You should point to the source on the page “Sources” and press the button “Clear cache”.
There is a special function (“Mass files deletion”) for mass deletion of files in the menu. Select the source from drop-down list, then the type (files and directories, when “directories” is chosen then the names of files are also available in the list). The names of files in the list are divided with transfer to another line and paths you point should be relative. For instance, if you need to remove from cache http://cdn.example.comimages/1.png and http://cdn.example.comimages/2.png then point in the list:
3.Work with Storage.
PixCDN works on cache principle: during the first direction to the file it is imported to cache CDN and when other requests to the file are made – is distributed from the cache already.
One can import files to the CDN cache from your server and from specially dedicated storage PixCDN.
If it is convenient for you to store files for CDN in your storage, then one should create a domain in the storage, set it up and point it as a Source.
One should press the button “Add” on the page of “Storage”. The access of files in the storage can be received via FTP and with help of rsync.
The data of FTP access is shown in the field “info” on the page “Storage” in the list.
The data of access rsync are set in the mode of storage editing (pencil in the storage list). One should enter the data of your server as the connection is initiated on the part of storage. Authorization on SSH key (you can get it in the storage list on the link “show” on the opposite side of “ssh key”. The activation of files transfer on rsync protocol can be performed from the admin area or via API.
After the domain is set on storage and the files are placed there, you should enter the domain name that is pointed in the field “Storage” as a source (on the page “Sources” in the mode of sources editing).