CDN/proxy for static site
Hosting static (or mostly static) sites, a CDN/proxy like Cloudflare, as I understand it, could be beneficial by:
- Reducing load/traffic to web server
- Improving performance and latency by caching and serving from endpoints closer geographically to many users (and probably better HW/network)
- Improve security by obscuring real IP, providing protection against possible DDoS
(Correct me if I'm wrong or miss vital arguments/points. I did read https://talk.lowendspirit.com/discussion/917/long-ish-post-on-content-delivery-networks-or-cdn/p1 , but maybe I skimmed through a bit too quickly.)
Seems to me Cloudflare's free offering is pretty hard to beat. So what would be good reasons for not choosing CF?
The reason I can think of is: They're BIG and own half the Internet (and I kinda like small providers), but still they don't appear to be evil ...
Other free/cheap options I really should consider?
I've seen BunnyCDN mentioned here, I don't think it's free, but what would be main benefits of these, or other paid options, compared to Cloudflare?
(I know there's paid CF services, but I think I'd be good with the free, at least for now.)
I've hosted quite a few sites without any CDN, but I'm eager to learn a bit more in this area.
(Not going to setup my own CDN/proxy network now, though that might be an interesting learning experience/experiment later.)
Comments
CF free offering is hard to beat simply because it's free. It isn't actually a killer offering by itself. For instance, they do not cache everything for you, I have no proof, but I strongly suspect they serve free tier from cache on a best effort basis, which is reasonable of course since it's free. It is becoming a common trick to utilise unused/reserved capacities as (arguably awesome) marketing resources instead of paying for ads. If I were them I would evict free tier from cache when a paying customer needs it.
Then there is monopoly argument. CF, Google, Facebook and other biggies own a scary part of backbone cables already, which makes it impossible to compete with them. Which leads to even greater monopolization and consumers loose their bargaining power and with it any power whatsoever which as history shows will be abused immediately. This is of course unprovable so make your own opinion yadda yadda...
Technically, I would prefer a CDN where I can directly upload static files, more like a distributed shared hosting than a cache. But that depends on a project.
Yeah, like Google more than a decade ago.
Cloudflare free offer is better than some paid CDNs and impossible to beat. If one needs (do you really need it?) or wants a CDN or DDoS protection, they are of course a good option and they are pretty cheap (at least for now). There is simply no other provider which will give you a hundred terabytes of free bandwidth in South America, Africa or Asia.
Anyway the internet has been gearing towards a path of centralization for a long time now thanks to those "improving" the user experience by the milliseconds. It is already unsustainable to host certain content at independent networks and that will only get worse with time.
OpenVPN installer | WireGuard installer
I also want to point out that if CDN didn't serve a request from cache it actually made it worse for that request because it leads to two requests instead of one, which increase amount of round trips establishing tcp sessions before any content is served.
1, You get access to all servers, not some undisclosed servers with undisclosed routing policies.
2. You get way better support. BunnyCDN and GCL always responded within hours, while Cloudflare support can take up a week if you're in their free tier.
3. You have access to some cool functions (like raw logs, monitoring, etc.) for free.
4. You can integrate with their storage zones (which is also quite cheap as well), and not bother about using web hosting/s3 for your static site.
TBH, CDN is now pretty cheap, so you could just sign up to one and learn yourself
BTW, Cloudflare and other CDNs are a bit different. Cloudflare is like CDN + WAF combined. However, I wrote this based on the CDN factor. You should really go to either CF or StackPath if you need both.
Netlify is another free option that will take care of hosting + CDN for static sites. https://www.netlify.com/
Cloudfront works well too if you've got a low traffic site, that's about $0.09/GB though iirc.
🦍🍌
What Is the volume of visitors and what is then intented audience and nature of content ?
Finally choice of cms...
All will help answer the question
For an image heavy site investing in an Cdn for image (Cloudinary, gumlet.. even Cloudjiffy...) and a lightweight content management system would work well. All have generous base tiers, free or otherwise. Though I am not a fan of free personally.
For the more adventurous, set up image folder on a NAT and use a script or Plugin like Shortpixel Adaptive images (WP only). For less than a dollar a month you get image hosting and images Optimizer for site. And some creativity and learning along the way.
or cdn with storage for other files. Bunny CDN I believe, and PUSHRCDN both have that feature . Also works for audio, when I had email exchanges with @PUSHR_Victor in March for one of my projects, they had asked if I was looking at the storage option also. But Corona happened and the project went nowhere.
If video makes sense to opt for annual subscription of Vimeo and use the embed. That takes care of 90 percent of traffic.
With gumlet you can also serve Javascript files or pdf... so that takes care of the other type of Files or content.
That leaves you with the web page itself- any lightweight cms (I had used Bludit on @smallweb Singapore till recently, moving to other cms for other reasons). Or textpattern.
There was good discussion on that cms in one of the posts here. Images served from a couple of CDNs. @WSS might be gracious enough to offer a discourse on Textpattern...
Best wishes in your endeavour.
VPS reviews and benchmarks |
TXP isn't really designed for CDN use. It'll require plugin work for an inline redirect of images.
My pronouns are asshole/asshole/asshole. I will give you the same courtesy.
They'd have a ridiculous amount of cache contention (https://www.cloudflare.com/learning/what-is-cloudflare/ says 26 million sites use Cloudflare), so the caches definitely aren't warm for many users of the free plan, particularly if the site doesn't get many hits.
Daniel15 | https://d.sb/. List of all my VPSes: https://d.sb/servers
dnstools.ws - DNS lookups, pings, and traceroutes from 30 locations worldwide.
I experimented with Gumlet and TXP- works partially, using their script,
https://docs.gumlet.com/quick-start-guides/getting-started#option-1-gumlet-js-library
unfortunately a pain in the rear end.
VPS reviews and benchmarks |
That's TXP for ya.
My pronouns are asshole/asshole/asshole. I will give you the same courtesy.
Yes, I'm currently hosting one production site and a few testing sites on Netlify. It's kind of what started me looking into this, as I was surprised by performance not being too great. Their paid plan is a bit of a jump up from free. So I thought I should play with some different options and do some measuring/benchmarking.
Didn't know about Cloudfront, thanks.
Am also considering Render.com and Firebase. (Not that using Google would be any better that Cloudflare if concerned about monopoly ...) (For hosting static pages, GitHub Pages and BitBucket Pages would also be an option. I guess I should test for performance.)
It definitely sounds like I should do some testing. Maybe my experience of Netlify free not being too impressive, was due to low traffic and stuff not being cached. (I also played around with headers to make it cache fonts and images explicitly for a longer period.)
Fair point! Interesting to read old google "why use" page from 1998:
http://web.archive.org/web/19990508133719/http://www.google.com/why_use.html
I probably don't really need it. It's sort of what I'm trying to figure out/learn more about, though ...
Thanks, I should check out those, and that sounds like a plan!
In my head the WAF acronom stands for wife acceptance factor ... I'm not so sure I need a web application firewall for my static sites.
My understanding have been that static sites would be a good candidate, so I'm playing around with some blogs and static pages, using a few images and text, maybe a form or two thrown in. (CMS being static page generators or handwritten or some app-generated HTML.) Volume of visitors of these sites I'm experimenting with, are low.
After I'm more confident that I understand the nature, pros and cons of different approaches, I could consider implementing CDN for some Wordpress installations with quite a bit more traffic and use. (They do work pretty well with caching etc., though.)
Thanks! I read your article on CDN and the media stuff, found it very interesting. A bit further down the line I will probably be looking into more media/image heavy hosting.
Yes, some customers rely heavily on Vimeo for video.
Interesting. One customer hosts quite a few PDFs, but I think he uses Issuu or something, embeds their reader.
I have on my todo list to check out other approaches for him. Should check out gumlet, then.
I haven't used Bludit, but quite a few others, like Grav etc. My prospects for testing CDN are all generated/flat HTML, though, not dynamically served.
I have been playing with TextPattern, and it's definitely something I'll play more with. But I didn't think it a good fit for this CDN experimentation/learning.
Thanks!
Netlify is very good! We're using it for the Yarn (https://yarnpkg.com/), React (https://reactjs.org/), and Babel (https://babeljs.io/) sites. One of the features that I love is that if your site is on Github, pull requests get a link to a preview version of the site, with the changes in the PR. Makes it a lot easier to review pull requests.
Daniel15 | https://d.sb/. List of all my VPSes: https://d.sb/servers
dnstools.ws - DNS lookups, pings, and traceroutes from 30 locations worldwide.
CF free plan is best. It does not caches everything by default. But you can enable it with Page Rules.
I'm using CF worker which has increased my site speed a lot! The worker runs locally on their 250+ datacenter/cities, it checks if a page/resource is already on their Edge cache, if yes, it instantly shows it, if not, it will Pull the page, cache it on local edge, and serve it to 2nd, 3rd, 4th, visitor to same page/resource. So my Tokyo visitor may get cached page from Hong Kong edge though my Origin may be Europe/US, but the second visitor from Tokyo will get cached page from Tokyo edge itself. If there is NO Worker, then Cloudflare caches ONLY if a resource has many HITs. Not just 1 or 2 hits! Thats an advantage of CF + Worker and only CF!
For images, I use B2 storage, and cache the resource for 1 year on CF edges. I use same worker script which helps not poke B2 storage for data transfer. It checks if image is cached on CF, if not, it caches locally on every edge (where a visitor makes a hit), and serves it from their itself
Another CDN it tried was Incapsula. They have good PoPs in US/EU. But it seems they don't offer free plan anymore! (at least I couldn't find on their site)
★ 30GB cPanel Hosting $1.49/mo | VPS & Reseller Hosting $14.38/yr
(aff)
Right, if a resource/page get fewer than 3 HITs from a single edge location (e.g. Tokyo visitors hitting Tokyo edge), then it is not cached at all. More hits are required to keep it warm is what they posted long time back in their CF forum. I don't know if that change/improved or not yet. PLUS there is a policy for how much time/days a resource is kept WARM (usually a month), or a CF-dynamic status header is issued for next visitor until it again get warmed!
★ 30GB cPanel Hosting $1.49/mo | VPS & Reseller Hosting $14.38/yr
(aff)
If you still can login to incapsula, they still offer it, but http only site..
https must upgrade to their paid plan..
Unlike Google a decade ago, the CF c-suite already has questionable politics, and I don't trust them.
In the pantheon of giant tech companies, Google still looks pretty good. Everyone loves MS these days, but they've done some really awful stuff.
This is grading on a scale. Google is a publicly traded company, and that warps morality.
Google is not. Google pleasing totalitarian countries and helping them suppress freedom of expression.
Freedom of speech, only once in a lifetime.
Action and Reaction in history
Which is part of the whole grading on a scale and warped morality thing. Every company complies with the laws of the countries they do business in because their object is to make money. Full stop.
No company is going to save people from any government. Like Oasis said, "Don't put your life in the hands of a rock 'n roll band." The companies which have challenged a countries laws, such as Lavabit, got shutdown, which makes me think CF is more then willing to play ball with government requests. (Lavabit is back, by the way.)
Next, compare Google to the right-wing cesspool that is Facebook which has sold people out multiple times, Amazon being a sweatshop, or any company that is part of the military industrial complex. On the scale, Google is fairly benign. They could be better, but the problem is more with capitalism as the only thing amoral is not making money.
Uhm- turn around. I can tell you for a fact they love money, but they do not like Republicans.
My pronouns are asshole/asshole/asshole. I will give you the same courtesy.