4 ms·
If you use a CDN such as Cloudflare, you can do a similar trick but forget about the proxy cache (and associated storage needs) - as long as every image at ever
by skrebbel 11y ago
If you use a CDN such as Cloudflare, you can do a similar trick but forget about the proxy cache (and associated storage needs) - as long as every image at every size gets a unique URL and you control http cache headers correctly, Cloudflare will store copies of every image size ever requested across their CDN network.
In terms of this blog post, you'll only need the "resizing server". This is a very simple and stateless way to get image thumbnailing to work. I'd also personally not bother with all the API key stuff - how 'malicious' can it be to generate a thumbnail of a public image?
This will even work with 3rd party images (the case of the app I used this for, it was product icons from Apple's App Store). If you somehow want to use images hosted elsewhere inside your app, but worry about speed or about hitting their servers too much, proxy them with Nginx and let Cloudflare handle the rest.
- jaxondu 11y agoThe blog post implements the "resizing server" on nginx to prevent the hits on application server. One alternative is to use AWS Lambda which has a sample code solution precisely on S3 image thumnailing.
- rgbrenner 11y agoThat's not quite true. Cloudflare (like virtually every CDN) only caches files at the edge server that handled the request. And they purge the files after a short period of time--even if your cache-control headers ask for a longer time. Most won't tell you how short (including Cloudflare), but some CDNs will delete files after as little as two hours.. 24 hours is very common. Most CDNs also give you no visibility about what is cached and where. In Cloudflare's case, they operate 76 data centers. So every "short period of time" x up to 76, your server will need to regenerate each image. So while a CDN is useful, a proxy cache can still be helpful. (None of this applies to NuevoCloud though.. NuevoCloud has a global cache, with dedicated caches for each customer. So it's entirely possible to keep an image at the edge indefinitely)
- true_religion 11y agoI'm curious. $99/TB seems like an incredibly high price to charge for a CDN that only has 10 points of presence globally. Maybe this is typical with 'website accelerators' as opposed to CDNs that focus on caching truly static content, but even so features like dynamic acceleration and global caching are par for the course with any traditional CDN. Cloudflare, which I use mind you, is non-traditional and their business model seems more suited to DDoS prevention and edge SSL than anything else. So what sets NeuvoCloud apart?
- rgbrenner 11y agoDynamic acceleration at Cloudflare (Railgun) is $200/website. Origin shield is $200/website at MaxCDN (could be wrong, but I don't think Cloudflare has an origin shield equivalent). Both are included with NuevoCloud, and you can use them on multiple websites. Global Cache does not exist at any CDN that I'm aware of. We spent a lot of time developing this. It's true other CDNs will cache files at each POP, when that POP sees a request for it... but that isn't what we mean here. (I understand the confusion.. I get a lot of questions about this, and we should probably rename it.) Global Cache means we have a single cache that is used/managed globally. Let's say a visitor in France gets a cache miss for a new file on your website. Every PoP at NuevoCloud now knows of that file and has it cached. So if the next visitor to your website is in Tokyo, they'll get a cache hit and the file will be served from the Tokyo PoP, even though it's the first time the Tokyo PoP has seen a request for that file. A cache hit at a traditional CDN means that PoP has the file; a cache hit at NuevoCloud means every PoP in the world has that file. The cache is managed for each customer individually with guaranteed space at each PoP. Which means, even if you have a small website that receives no traffic.. you can still keep your files at the edge. The only other way to get this is to pay for a dedicated CDN. Finally traditional CDNs send requests from the edge directly to your server (client > edge node > your server) which is a long distance connection. Connections through NuevoCloud are routed through our network: client > edge node > edge node > server. So both the client and server are talking to an edge node near them. This speeds up SSL and connection negotiation between the edge and your server. We also use this setup to dynamically route requests around high latency, network partitions, etc. I put our 10 points against other CDNs daily... and it's faster. You would be surprised at how dumb the average CDN is when handling requests. This is the reason they scatter edge nodes all over the place.
- nathancahill 11y agoMight want to throw a disclaimer on the end there?