CDN/proxy for static site

flipsflips OG
edited May 2 in General

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.)

Tagged:

Comments

  • comicomi OG
    edited May 2

    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.

    Karabudera

  • NyrNyr OG

    @flips said: They're BIG and own half the Internet (and I kinda like small providers), but still they don't appear to be evil ...

    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.

  • comicomi OG
    edited May 3

    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.

    Karabudera

  • sanvitsanvit OG
    edited May 3

    @flips said:

    Seems to me Cloudflare's free offering is pretty hard to beat. So what would be good reasons for not choosing CF?

    1. Cloudflare doesn't cache everything. Cloudflare only caches specific file extensions, which may be sufficient for some, but may not be for others (you can choose to cache everything on page rules, but it costs to add more than 3).
    2. You don't have access to all servers, and you don't always get routed to the closest PoP if you're not on their business/enterprise plan.

    Other free/cheap options I really should consider?

    1. BunnyCDN (aff) : Paid, but has awesome service and support, and has lots of functionality (raw logs, origin shielding, monitoring, statistics, edge rules, etc.) at no extra cost.
    2. GCoreLabs CDN : Has 100GB/m free tier (10EUR signup fee). More expensive than BunnyCDN depending on your subscription tier and user locations. Most functionalities costs extra $$$s.
    3. StackPath : Need to subscribe at least 1TB. Overage is usually more expensive than BunnyCDN. Has limited functions compared to BunnyCDN.
    4. PUSHR CDN : I never used, but they seem to have a rep on LET.

    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.)

    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.

    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.)

    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.

    Thanked by (3)comi Not_Oles g4m3r
  • 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.

    🍌

  • vyasvyas OGContent Writer
    edited May 3

    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.

  • WSSWSS Retired

    TXP isn't really designed for CDN use. It'll require plugin work for an inline redirect of images.

    Thanked by (1)vyas

    My pronouns are asshole/asshole/asshole. I will give you the same courtesy.

  • @comi said: 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.

    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.

  • vyasvyas OGContent Writer

    @WSS said:
    TXP isn't really designed for CDN use. It'll require plugin work for an inline redirect of images.

    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.

    Thanked by (1)WSS
  • WSSWSS Retired

    That's TXP for ya.

    Thanked by (1)vyas

    My pronouns are asshole/asshole/asshole. I will give you the same courtesy.

  • @Harambe said:
    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.

    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.) :)

    @comi said: I strongly suspect they serve free tier from cache on a best effort basis

    @sanvit said:
    Cloudflare doesn't cache everything. Cloudflare only caches specific file extensions, which may be sufficient for some, but may not be for others (you can choose to cache everything on page rules, but it costs to add more than 3).
    You don't have access to all servers, and you don't always get routed to the closest PoP if you're not on their business/enterprise plan.

    @comi said:
    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.

    @Daniel said: 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.

    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.)

    @comi said: 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

    @Nyr said:

    @flips said: They're BIG and own half the Internet (and I kinda like small providers), but still they don't appear to be evil ...

    Yeah, like Google more than a decade ago.

    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

    @Nyr said: If one needs (do you really need it?) or wants a CDN or DDoS (...)

    I probably don't really need it. It's sort of what I'm trying to figure out/learn more about, though ... :)

    @sanvit said:
    1. BunnyCDN (aff) : Paid, but has awesome service and support, and has lots of functionality (raw logs, origin shielding, monitoring, statistics, edge rules, etc.) at no extra cost.
    2. GCoreLabs CDN : Has 100GB/m free tier (10EUR signup fee). More expensive than BunnyCDN depending on your subscription tier and user locations. Most functionalities costs extra $$$s.
    3. StackPath : Need to subscribe at least 1TB. Overage is usually more expensive than BunnyCDN. Has limited functions compared to BunnyCDN.
    4. PUSHR CDN : I never used, but they seem to have a rep on LET.
    (...) TBH, CDN is now pretty cheap, so you could just sign up to one and learn yourself

    Thanks, I should check out those, and that sounds like a plan! :)

    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.

    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. :)

    @vyas said:
    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

    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.)

    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.

    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.

    If video makes sense to opt for annual subscription of Vimeo and use the embed. That takes care of 90 percent of traffic.

    Yes, some customers rely heavily on Vimeo for video.

    With gumlet you can also serve Javascript files or pdf... so that takes care of the other type of Files or content.

    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. :)

    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...

    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.

    @WSS said: TXP isn't really designed for CDN use. It'll require plugin work for an inline redirect of images.

    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.

    Best wishes in your endeavour.

    Thanks!

    Thanked by (3)vyas sanvit comi
  • 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.

    Thanked by (1)flips
  • edited May 4

    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)

    Thanked by (2)comi g4m3r

    Hello.

  • @Daniel said: 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.

    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!

    Thanked by (1)comi

    Hello.

  • NdhaNdha OG

    @nickelodeon said:
    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)

    If you still can login to incapsula, they still offer it, but http only site..
    https must upgrade to their paid plan..

    Thanked by (1)nickelodeon
  • @Nyr said:
    Yeah, like Google more than a decade ago.

    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.

  • @FlamingSpaceJunk said:

    @Nyr said:
    Yeah, like Google more than a decade ago.

    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.

    Thanked by (1)WSS

    You're not selfish, you're just ignorant. Show some respect for humanity.

  • @elliotc said:
    Google is not. Google pleasing totalitarian countries and helping them suppress freedom of expression.

    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.

  • WSSWSS Retired

    right-wing cesspool that is Facebook

    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.

Sign In or Register to comment.