13 ms·
Set up a practically free CDN
- cj 5y agoI was expecting to read about how to set up the infrastructure to run my own CDN infrastructure for free (hard to believe is possible, so I clicked). Instead, it's an article about how to use Cloudflare to deliver static assets for free, on Cloudflare's free tier. Edit: I would love to read more about how to set up a cheap self-managed CDN, perhaps using cheap VPS servers spread out in different regions.
- vbernat 5y agoThis link may be of interest: https://www.linkedin.com/pulse/build-your-own-anycast-network-9-steps-samir-jafferali/ https://www.linkedin.com/pulse/build-your-own-anycast-networ...
- cmroanirgo 5y agoI've been wanting the browsers to support SRV dns records for quite some time now. Unfortunately, both firefox and chrome have bugs in the WONTFIX status. The reasons for these statuses given are poor imo, but the implementation could add an extremely interesting dynamic to the internet. It would be easy to set up vps around the world and let SRV records set up in a round robin manner control it. Will it be as good as a bgp controlled one? Unlikely, but it would be 100% in your control and easy to set up, unlike going cloudflare. https://bugzilla.mozilla.org/show_bug.cgi?id=14328 https://bugzilla.mozilla.org/show_bug.cgi?id=14328 https://bugs.chromium.org/p/chromium/issues/detail?id=22423 https://bugs.chromium.org/p/chromium/issues/detail?id=22423
- teddyh 5y agoSRV support seems to have been (unfairly, I think) rejected by HTTP vendors and standard bodies. There is a new standard, however, in the works: https://datatracker.ietf.org/doc/html/draft-ietf-dnsop-svcb-https-08 https://datatracker.ietf.org/doc/html/draft-ietf-dnsop-svcb-... https://github.com/MikeBishop/dns-alt-svc https://github.com/MikeBishop/dns-alt-svc This one might have a larger chance of being accepted, since it provides some things which HTTP standard bodies and HTTP client vendors want. It doesn’t (at this stage, anyway) provide for the load-balancing “weight” field from the SRV record, but it does support MX-style priority numbers, and also port numbers. Very interesting, to say the least.
- deleted 5y ago[deleted]
- lewisl9029 5y agoIndeed, I was expecting something like this: https://fly.io/blog/the-5-hour-content-delivery-network/ https://fly.io/blog/the-5-hour-content-delivery-network/ Good thing it already exists!
- deleted 5y ago[deleted]
- ignoramous 5y ago> I would love to read more about how to set up a cheap self-managed CDN. See also: https://blog.apnic.net/2021/04/07/building-an-open-source-anycast-cdn/ https://blog.apnic.net/2021/04/07/building-an-open-source-an...
- searchableguy 5y agoMany of the files will violate cloudflare terms of service. You cannot put video files behind normal cloudflare cdn as an example. This is a risky setup.
- sascha_sl 5y agoFWIW a partner of mine has been using this setup less for the CDN aspect and more for the free B2 egress, and a TB or two of large encrypted files (rclone crypt remote) have not resulted in any complaints.
- fivre 5y agoThis part of the Cloudflare ToS only applies to cached content. They're fine with simply proxying to your video files.
- magila 5y agoThat is not true. Cloudflare's ToS prohibits serving video files via their CDN regardless of whether they're cached or not.
- colejohnson66 5y agoWhy?
- magila 5y agoVideo streaming consumes dramatically more bandwidth than the HTML/CSS/JS/JPEG/etc files which Cloudflare's CDN is intended to serve. Bandwidth is cheap, especially for Cloudflare, but it's not free. Cloudflare's base pricing, and especially their allowance for free accounts, does not account for such large bandwidth consumption. Cloudflare does have a product specifically designed to stream video. It is priced accordingly.
- charcircuit 5y ago
- boffinism 5y ago> 440% cheaper than S3 per GB. However the author thinks percentages work.... They are not right.
- parsadotsh 5y agoIt does make sense. Consider the phrase "twice as cheap"
- boffinism 5y agoWhat is 440% less than 1, then? In my book, it's -3.4.
- deleted 5y ago[deleted]
- sascha_sl 5y agoIt should be percentage points, because "100% cheaper" would already be free. It probably means AWS is 440% more expensive.
- Rastonbury 5y agoTechnically yes but no person is reading that and thinking backblaze is paying you or its free. Its a nitpick
- deleted 5y ago[deleted]
- mulmen 5y agoI have always found that phrasing to be confusing. Consider the reciprocal, “half as cheap”. Should that be interpreted as… double? Say “half the cost” or “cheaper by half”.
- Dylan16807 5y ago
- DoctorOW 5y agoThis seems more or less like the B2 help document on the matter: https://help.backblaze.com/hc/en-us/articles/217666928-Using-Backblaze-B2-with-the-Cloudflare-CDN https://help.backblaze.com/hc/en-us/articles/217666928-Using...
- modeless 5y agoI've been using Cloudflare free in front of App Engine's free tier for a few years and it really seems too good to be true. I can go viral and scale to infinity, for exactly $0.
- anaganisk 5y agoThe other day one of the commenters under a post wanted to spend $20 per month to host a static website to handle HN traffic, I just LOL’d. I tried to be good and explain why it was so unnecessary but nah they would rather bring a canon to a water gun fight.
- anderspitman 5y agoYeah a static webserver on a low end VPS is more than sufficient for front page traffic.
- sofixa 5y agoOr a fully static host, like Netlify, Firebase Hosting, CloudFlare Pages, etc. which have extremely generous free tiers. I got twice to top ~15 of the HN front page, including once briefly at #1, within a month ( the billing period) and got to only ~90% of my bandwidth allowance of the Firebase Hosting free tier ( which isn't the most generous one). Not only is it cheaper, it's also with less hassle ( there's nothing to manage, you just send static HTML / code to build to static HTML).
- anderspitman 5y agoWhat would have happened if you hit 100%? DigitalOcean gives you 1TB for $5/mo.
- sofixa 5y agoI would have had to pay per GB out consumed at $0.15/GB.
- 5y ago
- ani-ani 5y agoAssuming this is for websites, what's the recommended way of handling cache busting with this kind of setup? The article has a slightly awkward paragraph that tells you to set long TTLs for everything and concludes with "tweak these settings", which kind of sounds like "draw the rest of the owl". Might be a good reason to use something that integrates all this (eg. Cloudflare Pages, since you're already using Cloudflare).
- sharps_xp 5y agocloudflare let’s you purge the cache via API, but frequent busting is probably not okay
- ricardobeat 5y agoThe usual approach is to add a value to the query string, like a last-modified timestamp or deployment version. Doesn’t require any setup on the CDN side.
- samwillis 5y agoThis B2/CloudFlare combination is a good one. CloudFlare are about to launch their own object/file store with native CDN called R2. They have even come up with a wonderful trick for migrating to it from S3 and it’s looks like it’s going to have an incredible generous level of free egress. I suspect that it will beat out the B2/CloudFlare combination once it launches. https://blog.cloudflare.com/introducing-r2-object-storage/ https://blog.cloudflare.com/introducing-r2-object-storage/ Edit: Typo
- outloudvi 5y agoYes. Cloudflare is doing many of their own stuffs recently: serverless, image processing, stream processing, mail forwarding, storage etc.
- atlgator 5y agoCloudflare stock is cheap right now too.
- dillondoyle 5y agoWhat is your opinion on what's driving the movement? I went in fairly big (for me) and sold near the top with a stop loss #gainz. Then bought again when it went down like 10% trying to 'buy the dip.' But it keeps falling! I don't get it. I love their products and ambition. That was a huge bump and decline.
- candiddevmike 5y agoNot the parent but I think Cloudflare's free tier is too good and the paid offerings don't compete well if you're all in on a cloud provider already. It also may be the classic Cloudflare has "features" but doesn't have a "product". Anecdotally, I have yet to work with a company paying Cloudflare substantial amounts of money.
- dillondoyle 5y ago
- destitude 5y agoHaven't a lot of people on HN warned against using Backblaze for backup because of issues restoring from backup? I recall reading someone having to pay to have a physical drive sent to them to restore a backup because of speed/cost issues trying to restore over network.
- hinkley 5y agoNever underestimate the bandwidth of a station wagon full of data tapes hurtling down the highway. Randall Munroe estimates it'll be 2040 before the Internet has more bandwidth than FedEx: https://what-if.xkcd.com/31/ https://what-if.xkcd.com/31/
- celsoazevedo 5y agoYou're probably thinking about their computer backup service. This post talks about B2, an object storage service like S3. While B2 isn't as fast as S3 and some tasks are way slower (eg: deleting files), I'm able to max out my server's 1Gbps connection when sending or downloading files from their European DC (using rclone and a server also in Europe).
- Rastonbury 5y agoI think it's their consumer facing Dropbox like desktop tool not B2
- wrycoder 5y agoThey will refund the drive cost when you mail it back.
- magicjosh 5y agoIs anyone building CDN service on top of IPFS? IPFS is certainly too slow for many applications but perhaps there are tiny niches where it makes sense today? More like tape drive storage?
- yawnxyz 5y agoCloudflare has a CDN gateway on top, but they don't do pinning (just kidding, you can add a site to IPFS through CF now — edit2: I still don't think they do pinning... really can't tell): https://developers.cloudflare.com/distributed-web/ipfs-gateway https://developers.cloudflare.com/distributed-web/ipfs-gatew...
- testesttest 5y agoIn my experience their gateway is not great and serves captchas occasionally if you're requesting rare content they don't have cached. I ended up just running my own node at a provider supporting bandwidth alliance and putting cloud flare in front of that.
- outloudvi 5y agoB2-Cloudflare was a great companion when Cloudflare's Bandwidth Alliance was a thing and outgress from B2 to Cloudflare didn't cost anything, which means that outgress was completely free since Cloudflare don't charge on outgress.
- ksec 5y agoThis reads to me as B2 / Cloudflare are no longer in Bandwidth Alliance?
- vlovich123 5y agoStill seems to be listed here: https://www.cloudflare.com/bandwidth-alliance/ https://www.cloudflare.com/bandwidth-alliance/
- timtom39 5y agoBandwidth Alliance isn't a thing anymore? My deployment is still serving multiple TB a day free. Do you have a link?
- ricardobeat 5y agoWhy “was”? Seems like everything you mentioned is still true. It’s the whole point of the post.
- outloudvi 5y agoOh, that's cool! I once could not find the page so I thought it had stopped.
- punnerud 5y agoDoes it support byte-range? so it can be used as a “server free” SQLite database: https://phiresky.github.io/blog/2021/hosting-sqlite-databases-on-github-pages/ https://phiresky.github.io/blog/2021/hosting-sqlite-database...
- anderspitman 5y agoI'm pretty sure all S3-compatible services support byte ranges. Ready for someone to come out of the woodwork to prove me wrong.
- killingtime74 5y agoYes I’ve used it
- anduru_h 5y agoI've been using BunnyCDN - it's been pretty cheap (<$5 month for 250GBs of data transfer).
- mike503 5y ago+1 for Bunny, if you cannot take advantage of a free tier somewhere and have to pay. Setup a client of mine on it for video and images, real-time image modifying/branding, smooth video playback (without using a special product) all using the equivalent of presigned URLs - for a surprisingly low amount of money each month. Lots of good stuff going on there. They also have their own storage options that are tightly integrated to their CDN, but basic FTP and simple API for it still. No S3 or bulk options there yet. Promised S3 API support “soon” though
- aantix 5y agoInteresting setup. And with Rails, it appears that there’s a third party ActiveStorage adapter for BackBlaze. https://github.com/jeygeethan/activestorage-backblaze https://github.com/jeygeethan/activestorage-backblaze Direct uploading from client : https://github.com/jeygeethan/activestorage-backblaze-javascript https://github.com/jeygeethan/activestorage-backblaze-javasc...
- jrochkind1 5y agoBackblaze also has an S3-compatible API, so you should be able to use the S3 adapter with backblaze too, instaed of the third-party backblaze-specific adpater using backblaze-specific API. You can use either S3 API or Backblaze API with the same bucket, simultaneously even.
- dinkleberg 5y agoI know every use case is different, so this may not matter for most. But in my experience, the performance of B2 was quite poor in comparison to other S3 compatible options. It seemed like the crux of the issue was slowness in their API. Generating pre-signed URLs for file upload or download was quite a bit slower, resulting in a poor user experience in my application. If you're just using it to upload public static content for your site, this shouldn't be an issue. But if you're dealing with private content it probably isn't the optimal solution.
- dotancohen 5y agoI would love to hear more. I had a gig where we considered S3 and B2 for serving very private files (financial records). With B2 I could not find a good way to ensure that, assuming the URL is known, a file could only be accessed by an authorized party.
- frogger8 5y agoI am in the same boat currently in my research. In fact I posted this gist link we are discussing. My use case is confidential data and this solution won’t work if I can’t guarantee access is limited to specific users around the country. Is free, secure, and fast to much to ask? Joking of course.
- charcircuit 5y agoIs it not possible to just store it encrypted and then have your service give out the decryption key to authorized users?
- frogger8 5y agoGreat idea, I just need to move my thought of encryption on the sending client to encryption on the destination server since this is infosec related and sending client could be compromised. Thanks for the help!
- 5y ago
- marcodiego 5y agoWe have a free CDN. It is called bittorrent.
- Dylan16807 5y agoAh yes, 'CDN at home'. Sadly people's connections are so asymmetrical they're likely to have problems or get upset from that kind of thing.
- ggm 5y ago"if everyone does it, they won't let you do it" -the infinite cache life on CF only works because 99.99% of use of the cache stays in rational cache lifetimes. If everything had long persist, CF would begin cache ejection, and your cost goes up, or they change the ToS to forbid it. LRU exists for a reason.
- binarymax 5y agoI’m looking at wasabi to host some large (500-1000M) distributable binary files. Anyone have experience with them?
- breakingcups 5y agoQuite some caveats. Minimum storage used per month is 1TB. That means, if you store 250MB of files on there you will still be charged for the whole TB. Also, you will be charged for storing those files for at least 90 days even if you only keep them for 1 day. Lastly, and this is a very important one, you only have free egress equaling the total amount of data you have stored. So, say you have 2 TB stored, you can only egress 2 TB that month. If you start to exceed that limit they are free to suspend your account. So it depends very much on your use case, but there were too many risks for my use cases.
- atlas443 5y agoYeah, the bandwidth limit was a killer issue for my use case as well. I've heard from older businesses there were exemptions from limit for older enterprise customers but based on a couple sales calls I had with them, they no longer provide any exemption for bandwidth and there is no option to just pay for more bandwidth for any plan. The cost of accounting and having to always predict and significantly overshoot the amount of bandwidth needed easily outweighed any cost benefit wasabi gave for my use case. This seems like a strange limitation that they cant just charge me for max(storage_gb, transfer_gb) but it seems their infrastructure was designed with that limit in mind.
- binarymax 5y agoThanks! Didn’t see that anywhere on the site.
- kondbg 5y agoUsing Cloudflare to proxy B2 content seems like it directly violates Cloudflare's ToS. https://www.cloudflare.com/terms/ https://www.cloudflare.com/terms/ > 2.8 Limitation on Serving Non-HTML Content > The Services are offered primarily as a platform to cache and serve web pages and websites. Unless explicitly included as part of a Paid Service purchased by you, you agree to use the Services solely for the purpose of (i) serving web pages as viewed through a web browser or other functionally equivalent applications, including rendering Hypertext Markup Language (HTML) or other functional equivalents, and (ii) serving web APIs subject to the restrictions set forth in this Section 2.8. Use of the Services for serving video or a disproportionate percentage of pictures, audio files, or other non-HTML content is prohibited, unless purchased separately as part of a Paid Service or expressly allowed under our Supplemental Terms for a specific Service. If we determine you have breached this Section 2.8, we may immediately suspend or restrict your use of the Services, or limit End User access to certain of your resources through the Services. If this was truly acceptable and not in some grey area, why doesn't Backblaze simply route all downloads through Cloudflare by default, rather than having each individual customer go through the hassle of setting this up?
- cmeacham98 5y agoIf you only use this for "standard" CDN assets (like pictures that are part of your website styling rather than as an image host) and you also host your website on Cloudflare, I think it should be ok.
- celsoazevedo 5y agoBackblaze is part of the "Bandwidth Alliance", different rules apply: https://www.cloudflare.com/en-gb/bandwidth-alliance/ https://www.cloudflare.com/en-gb/bandwidth-alliance/ With this said, I believe there are restrictions for certain types of content (eg: video). Cloudflare needs to be more clear here to avoid confusion.
- webmobdev 5y agoDoesn't this violate net neutrality ... ?
- jcubic 5y agoYou can get literally Free CDN using GitHub repo: https://gist.github.com/jcubic/a8b8c979d200ffde13cc08505f7a6436 https://gist.github.com/jcubic/a8b8c979d200ffde13cc08505f7a6...
- onphonenow 5y agoSome caution with cloudflare: Because they give a lot away and post blog posts attacking AWS folks think they are cheap. But a lot of their free stuff may be in the marketing budget. The issue here is: 1) Their paid offerings for their core product, CDN, does not have a public pricing guide. That's a BAD sign if they claim to be competing on price. So we can pretty safely assume their paid service bandwidth charges are NOT the 80X cheaper than amazon despite their claims here. 2) They hype their bandwidth alliance. I tried following this up on Azure, it's basically all call a sales person / maybe you'll get a deal type stuff. Smoke and mirrors again. 3) If you actually try to use their CDN to serve something high bandwidth (games / software updates / video streaming) that is going to violate some type of clause which says that the free CDN is not REALLY unlimited. 4) Financially they spend a mind boggling amount on sales costs. Between sales costs and cost of sales I think they are negative relative to revenue. BTW - If you try any of the other "free" and "unlimited" providers (for $5/month etc) you will also find out once you try to move some real data volumes (video etc) - it's all a lie over and over. Same things with geo issues. Cloudflare claims to have "one" price globally. These are almost alwyas false claims. It's easy to test - setup a stream into a high cost area, stream a bunch of video there - you'll usually get a call over some tricky TOS issue they pull out. In short, if you want pay and forget, there is a reason the big cloud players have a business still.
- frogger8 5y agoLooking at your comment history, you mention AWS often. Do you work there?
- roblabla 5y agoThey're one of the top, if not the top, cloud providers. It's not surprising to mention AWS here, and GP also mentions Azure...
- samhw 5y agoI’m aware that I’m inviting a “bad bot” riposte by saying this, but it’s: > one of the top cloud providers, if not the top rather than: > one of the top, if not the top, cloud providers since the latter cashes out to: > one of the top cloud providers, if not the top cloud providers (Sorry. I know it’s annoying … but it’s my life’s mission to eradicate this particular construct.)
- sixhobbits 5y agoI have been very happy with DigitalOcean spaces for $5/month including 250GB storage, 1TB outbound, and custom domains. Seems like something more closely comparable to this set up so I am surprised it isn't part of the comparison.
- aftbit 5y agoI've done this by using Cloudflare Workers. I can confirm that I did not see any bandwidth charges at B2, although I've only tested a few GB of transit. Likely if you tried to host brew here, you'd get yelled at.