
How we managed to build a video hosting service for 1 ¢ / GB
Why is video hosting so expensive
Of all the types of static files used on websites, the most stringent hosting requirements are associated with videos:
- Styles, images, and especially scripts delay the time the page is ready to use, so response time is important. On the other hand, the size of such files is usually small, cacheability is good, partial download is not important.
- Video files are large, cacheability is poor (most viewers watch a particular video for the first time), while the user may want to watch an arbitrary part of the video. On the other hand, speed of delivery is important so that the video can be watched without interruption in buffering.
- The downloadable software is relatively large, but the delivery speed is not as critical as in the case of video.
Renting servers for video hosting in the USA is much cheaper (per outgoing gigabyte) than in many other countries. However, the delivery of video from American servers to other continents is rarely fast enough so that a movie can be watched without interruption in buffering, and so that the waiting time before starting playback is acceptable. Therefore, owners of sites with videos that appeal to an international audience have to rent local servers in different parts of the world closer to their users. Showing a video to a user from Russia, for example, costs a typical video site several times more expensive than showing the same video to an American. You have to pay more or lower the quality of the video for foreign viewers. So go after this to the international market.
To solve this problem, we had to make software smarter. What is a typical static file server? Open the requested file in the right place and send it to the channel. A typical browser-based video player? Request a file from the right place, wait for some minimum buffer filling, show the video, while continuing to download it. If the buffer is empty, wait for filling.

Five servers instead of one
Hola CDN technology brings improvements to both client and server software. The player running in the browser does not download video from one, but from five different servers. One of them is the very reliable, close to the user, but expensive server that I wrote about above. It belongs to the CDN, which our customer has used before us. The remaining four are selected from the server pool that Hola rents from various virtual server providers where it is cheaper - in the USA, France, and the Netherlands.


It is important for the user that video playback starts as early as possible. Therefore, the first fragment at the beginning of the video or after jumping forward is downloaded from an expensive and fast server. But the remaining fragments are downloaded “for the future” from Hola CDN servers. Due to the geographic location of the user, these fragments can be downloaded longer than their playback time, and any one of the secondary servers may not be accessible at all. But smart client software can download fragments from different servers in parallel, and also exclude the use of inaccessible servers. As a result, most of the video file is downloaded in parts from cheap servers, and then unnoticed by the viewer it is glued into a continuous video stream. Client code continuously measures load metrics from different servers and makes decisions about
In addition, the Hola CDN client code caches downloaded video clips in a quality manner. Even if the viewer does something that skips back and forth over a long film, not one of the already downloaded fragments will have to be downloaded again, as is often the case with most of the common web players now.
As for the Hola CDN servers, they are smart mirrors. They download from the primary CDN and store copies of popular video files, and fragmentary.
Other measures to save traffic
Another important measure aimed at reducing hosting costs is not to upload too many videos for future use. Very often the user does not watch the video to the end. At the same time, most web players download as much as they can download, and if the user has a quick connection, they may have time to download the entire movie while the user watches a quarter and decides not to look further. Our player only downloads a limited video length, sufficient for uninterrupted playback. The last two functions are available for free and save traffic even to those who do not use Hola CDN servers.
Hola CDN can work both in browsers with support for HTML5 video, and in those where you still have to use Flash to play video. We recommend customers our own Hola Player, built on the basis of video.js , but we can work with JW Player , as well as with any player based on HTML5. We use Media Source Extensions technology to deliver separately loaded fragments to the HTML5 video player.
To play
For Habr’s readers, we first publish a link to our internal tool for testing client code on various combinations of players, formats and usage scenarios. Welcome, you can play around! Naturally, we do not guarantee that all this works, that it will not change in the future, and that we will not decide to remove this page at all. Many combinations there definitely do not work, and some are generally impossible even theoretically.
Come to us
We are already seeing the first satisfied customers, while many other potential customers are in the process of being set up and tested. We still have a lot to do: add support for live video streams, various video formats, players ... Therefore, we need good programmers . Work is remote (or in the office, if you live in Israel), the schedule is never more flexible, high earnings. Our selection from the test task to the successful completion of the trial period is on average one out of 250 candidates. You should be well aware of the JS that we use both on the client and on the server.
If you are interested in working at Hola, or if you know someone who might be suitable for us, write to me at alexey@hola.org. If you bring someone who will pass the selection and work with us for the first three months, we will pay you 7000 USD .