manogi / october-mediathumb

Twig filter for automatic thumbnail images for your media images

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Page load time with S3 is excessive

frankkoornstra opened this issue · comments

First of all: great plugin, really nice of you to dedicate your time on this!

I was wondering if I'm doing something wrong because my page load times are really high when using Media Manager with S3. I think it's because you store the thumbs in the media disk (also S3) and check for the thumbs of all the images on every request. If they're there, fine, if not it means another roundtrip to S3 for every image to do the resize.

If that's right, I get why you do it but would it be possible to build a sort of cache option for "advanced users"?
I was thinking, if you register (in local disk cache) which image have already been resized, you could serve the link to the image immediately if found; if not, do the resize thing, write that you've done so to local cache and serve the link.
If users change the image, there could be a button in the plugin to invalidate the local cache, which would resize every image again (on request) because it's not found in local cache. Cache warming would be another possibility but not essential.

Hi Frank, I will have to look a bit deeper into this. Yes, the plugin checks if the thumbnail exists, and creates it if it doesn't. If in your case it is slow EVERY time, that would mean that the checking itself is slow... did I understand that right?

Maybe not for one thumbnail but, for instance, I have a carrousel with 20 images. For each of these images it will do (at least) one roundtrip to S3 so even if it takes say 50ms, that will come to about 1 second in the best case scenario (aka all images are already there).

If the script could check locally if a thumbnail exists (through a registry), it wouldn't need all those roundtrips to S3.

Unfortunately this is still a massive issue and makes the plugin unusable. Having 15 images on a page, already loaded once before so the thumbs are created still causes a very long page load. 30 seconds or more.