|
|
|
|
|
by maxk42
2508 days ago
|
|
I run a similar image host with many times the traffic of picsum as well as daily DDOS attempts. This is pretty much the approach I've chosen. (I don't use S3, but a similar setup.) My infrastructure is much simpler than this (CDN in front of Varnish? What the hell software do you think they're using for the CDN?) and my total hosting costs are about $150 a month since recently upgrading the server. Seeing articles like this just reaffirms for me: The people who write these articles are not necessarily experts. |
|
I request image42 and it's in the outer cache. I get served from the outer cache.
I request image127 and it's a cache miss on this server. It asks its backend, which is another cache, and this time it's a cache hit since it hadn't time out there yet.
I request image128 and my browser requests the same image again from the same backend, it doesn't even have to hit my load balancer the second time.
I request image2049. It's a miss on the outer cache. It's a miss on the inner cache. It gets generated by processing in a primary application. I then request it again, and I hit a different frontend cache. It's a miss in this frontend, but this cache is hopefully refreshed from that inner layer of cache rather than going all the way back to the application. If the load balancer pins traffic based on the ultimate end-user's IP to a particular inner-circle Varnish box via MRU then the chances are quite high that's what happens.
I request image4095 and it has expired from the inner cache, but is still unexpired in the outer cache so it never gets beyond the CDN.