Netlify Large Media TTFB

Hi, @luksak. I believe I have discovered the reason for the issue. I looked at the requests in the HAR file sent and the request were again uncached on that CDN node. Looking at the URL in HAR file, it has only been requested 30 times in the last 24 hours and no single CDN node has gotten more than 5 requests in that time window.

With a request rate that low, it is very unlikely for the images to be cached in local CDN nodes. There is more information about how the Large Media caching works in the post here:

I’m going to quote/inline some of that post below:

Here’s details about how we cache and charge:

  • Large media has a separate s3 bucket that we cache transforms in for 30 days. (In other words, it’s not affected by caching timeouts or behaviors we do with other pages/assets - you can count on a specific transformation result to be cached for 30 days regardless of our standard CDN node caching status).
  • We also cache on our CDN nodes the same way we handle caching for all other assets . (This also adds an extra layer of performance boost, where if a user is browsing your site on a single CDN node, it won’t have to go to S3 to re-fetch the transformed image.)
  • If a large media transformation result is found in either cache already, then the user is not charged for an additional transformation.
  • Every combination of file (checked by SHA, not just filename, since you may upload a new image with the same filename) and transform parameters requires a unique transformation call. So if you request mypic.jpg?nf_resize=fit&w=300 and then request mypic.jpg?nf_resize=fit&w=301 , we can’t use the first cached image, and have to do a new transformation. Similarly, if you upload a new version of mypic.jpg , and then make the above requests again, we’ll have to do two more transformations.

It is the return to the S3 bucket for cached transformations that is the issue here. That S3 bucket with in the the US and the CDN node fetching from that bucket is in the EU. This is adding additional latency for the requests when the images are not cached in the local (Frankfurt) CDN node.

I have entered a feature request to have the Large Media data be distributed like the CDN nodes are distributed, however, I cannot promise if that feature will become available. In the meantime, the performance you are seeing will continue for any URLs which are not being cached by the CDN.

I know this isn’t the news you were looking for so if there are other questions about this, please reply here anytime.

2 Likes