5 ms·
> If a page is static, then CloudFlare can cache it. But if you set your cache headers appropriately, and use efficient serving code like nginx, I imagine servi
by adamt 11y ago
> If a page is static, then CloudFlare can cache it. But if you set your cache headers appropriately, and use efficient serving code like nginx, I imagine serving static content is pretty darn cheap.
With the static content it's not the cost of serving it, it's the fact that Cloudflare is serving it from a large bunch of distributed servers that are likely to offer far lower latency to the end-user than your servers. With modern web pages often containing hundreds of objects, this can make a big difference to page load times.
If all your customers are in one geography this is less of an issue, but if you have a global audience this can make a huge difference.
- chubot 11y agoOK, but this is just the benefit of any CDN, not just CloudFlare right? So I guess the selling point of CloudFlare is that it's like a normal CDN, plus it offers security services like DDOS protection? With a normal CDN, you don't change your DNS to point at their servers right? DNS points to your server, but you change your code to have <img src="" > and so forth pointing at their servers. To me that just seems a lot less invasive, but admittedly then you can't get the security features.
- geofft 11y agoI'd say that the historic Akamai model (from the last bubble) counts as "a normal CDN", and in that case, you do change your DNS to point straight at Akamai's DNS servers. For well over a decade now, `www.microsoft.com` has been a CNAME for something run by Akamai. My rough and uninformed impression is that for small-time users, where "small-time" includes the scale of Reddit, CloudFlare can do what Akamai does at a much more reasonable price. But yes, that's a different sense of "CDN" from e.g. Google-hosted jQuery.
- chubot 11y agoOh really, I didn't know Akamai worked like that. Do you know of any docs describing the algorithm Akamai or CloudFlare use to decide whether to hit your origin server? I'm a stickler for correctness but it seems to be pretty easy to get into the situation where your users aren't getting what you intended. HTTP cache headers are a mess. To me it seems safer to code your application so the HTML points to JS/CSS/PNG with content hashes in the URL. Then you don't have any cache expiry issues -- nothing ever expires, but you control the assets exactly through your dynamic HTML. I think it's important to have fast and reliable rollbacks. You can imagine some situation where private content or offensive text is accidentally included with some static asset... I would like some guarantee about when users stop seeing it (preferably as soon as the application is redeployed).
- trashcan 11y agoIt looks like they determine whether or not the content is static by the extension: https://support.cloudflare.com/hc/en-us/articles/200172516-What-file-extensions-does-CloudFlare-cache-for-static-content- https://support.cloudflare.com/hc/en-us/articles/200172516-W... "CloudFlare does not cache by MIME type at this time." And most likely default to not caching if they are unable to determine. For dynamic pages you can tell them which ones can be safely cached with PageRules (on paid plans): https://support.cloudflare.com/hc/en-us/articles/200172826-Can-dynamic-sites-work-with-CloudFlare- https://support.cloudflare.com/hc/en-us/articles/200172826-C...
- geofft 11y agoAkamai has an API that you can hit to request that they purge some content of yours from their cache: https://api.ccu.akamai.com/ccu/v2/docs/ https://api.ccu.akamai.com/ccu/v2/docs/
- Nyr 11y ago> CloudFlare can do what Akamai does at a much more reasonable price. Not really. Akamai has presence inside many "too big to peer" networks, while CloudFlare doesn't (for now). You can't just compare CloudFlare to Akamai at the moment, they are following very different strategies.
- manigandham 11y agoCloudFlare seems to be rapidly expanding both datacenters and peering partnerships. Isnt the effective capability the same between both companies? Is there something that Akamai can do that CloudFlare cant?
- Nyr 11y agoThere is something which Akamai does and CloudFlare doesn't want to (at the moment): pay big sums to those big ISPs which refuse to peer and want to sell very expensive direct connections.
- manigandham 11y agoWhat does this mean for the company/application using CloudFlare or Akamai? Both services seem to be highly available and very fast from around the world. What does Akamai do here that's better?
- Nyr 11y agoAkamai has direct connections to those "difficult" ISPs, CloudFlare uses transit to reach them. To provide an example: transit to DTAG via GTT (CloudFlare) is always saturated at peak hours. So Akamai has a big advantage (direct connection) if you want to reach Deutsche Telekom customers.
- pandemicsyn 11y agoI assume its for this reason (and others) that even Amazon.com still uses Akamai. Stuff like product images/banners still get served from domains like g-ecx.images-amazon.com (which resolve to Akamai)
- andreyf 11y agoWell, routing everything through them via DNS obviously means less code in your application, so that's nice. Also, a CDN which routes all of your traffic via DNS can also take advantage of a private network to get the packets to your users faster, i.e. Cloudflare could potentially own a faster link between Virginia and Berlin than the public internet would take, and lower response time that way. I think that's what point two on the benefits list here is about: https://blog.cloudflare.com/cloudflare-is-now-a-google-cloud-platform-technology-partner/ https://blog.cloudflare.com/cloudflare-is-now-a-google-cloud...
- mixonic 11y agoA faster link, but also an already open TCP and SSL connection. By moving the TCP and SSL handshake to an edge-based server, you have much lower-latency when starting a request for the client. The long-haul high-latency connection between the edge and your server is already open, no extra roundtrips required.