21

I'm creating a website where people can upload and watch videos. I'm expecting 1000 simultaneous viewers at all times (on average). The problem is that all the CDNs I've looked at charges about $0.06/GB. This means that 0,17 MB/s (720p) x 1000 users x 60 seconds x 60 minutes / 1024 = $36 an hour to host!

Am I missing something?

Over at CloudFlare you don't pay for the bandwith. Does this mean that I can get it really cheap at CloudFlare. Isn't that too good to be true?

Student of Hogwarts
  • 1,108
  • 3
  • 14
  • 28
  • Updated CloudFlare support link: https://support.cloudflare.com/entries/22037282-what-file-extensions-does-cloudflare-cache-for-static-content – Michael Sørensen Jan 06 '13 at 11:14
  • I'm voting to close this question as off-topic because it's about hosting costs. – Flexo Mar 01 '15 at 07:56
  • caching streaming video through Cloudflare violates our Terms of Service. Not a good idea. – xxdesmus Jun 16 '17 at 03:07
  • 1
    No, caching videos is not allowed on Cloudflare. In their Terms https://www.cloudflare.com/terms/ it states: `Use of the Service for the storage or caching of video (unless purchased separately as a Paid Service) or a disproportionate percentage of pictures, audio files, or other non-HTML content, is prohibited.` – neave Feb 22 '19 at 12:38

3 Answers3

21

UPDATE FOR 2018!
Cloudflare now has a streaming video service to complement their CDN, so that would definitely be the first place to look. But if you just want to host a few MP4 files on your site and save a bit of bandwidth, the following post might still be relevant.


Assuming your video content is simply a file downloaded over HTTP/HTTPS (and not streamed over some other protocol) then it appears that CloudFlare might actually support this.

I just tested an MP4 video file on a client's website and it appeared to be cached by CloudFlare correctly.

My CloudFlare settings page rule:

enter image description here

The request (which shows a cache hit):

enter image description here

Community
  • 1
  • 1
Simon East
  • 55,742
  • 17
  • 139
  • 133
  • are you sure the ranges header would work, do you see that in your request? not sure cloudflare does that delivery properly, they might just move on – Rafael Sanches Dec 13 '16 at 16:12
  • Good question @RafaelSanches. I haven't tested the `Ranges` header, but it would be good to investigate whether Cloudflare supports this. – Simon East Dec 16 '16 at 04:44
14

The cache everything rule is going to cache it because it is basically doing that...caching everything.

We do not, however, recommend running streaming content through CloudFlare's proxy. People running streaming content on their sites should put it on a subdomain we don't touch.

damoncloudflare
  • 2,079
  • 13
  • 9
  • 8
    The article says *"We have seen sites have performance issues because of the number of connections that streamed content causes when running through the CloudFlare proxy"*. Can you elaborate on what that means exactly? Downloading an MP3/AAC/MP4 file within the browser (or a plugin) shouldn't cause excessive connections, should it? – Simon East May 22 '14 at 00:10
  • 1
    this is an old post. is this still the case? for videos that are smaller than 5mb? – Rafael Sanches Sep 28 '16 at 02:40
  • I am only using shared SSL on our Subdomain which has streaming m3u8 link but will be happy to know PageRule to deny stream serving from cloudflare proxy. – WhiteHorse Mar 25 '18 at 19:35
8

Yes, you're missing the point that Cloudfare will only cache "static and small" files, with these extensions: https://support.cloudflare.com/hc/en-us/articles/200172516-What-file-extensions-does-CloudFlare-cache-for-static-content- as you can see, mp4 and similar are not on the list.

So, assuming most of the cost is bandwith, you will have the same, but a faster website as some resources will be served by cloudfare CDN.

It all depends on how many videos will you have, but usually a dedicated server will offer much more storage (and enough bandwith) for a fixed monthly fee. The problem is that 1000 simultaneous viewers is too much for a single server serving the files.

eternicode
  • 6,805
  • 4
  • 33
  • 39
Ferran Gil
  • 424
  • 5
  • 13