Performance issues with many images on page

Created on 28 September 2023, about 1 year ago
Updated 20 October 2023, about 1 year ago

I'm experiencing performance issues with a focal point or contextual crop field "Media with contextual modifications" when there are many images on the page. For example on a page with 30+ of these image on our hosting platform Pantheon.io we will experience an application timeout whenever the page's cache is cleared. If the whole site cache is cleared we can experience this on all pages where there are many images.

Looking at the image styles timestamps on the OS it would appear that clearing the cache causes the image style needing to be deleted and rebuilt every time which would appear to cause the timeouts. Just wondering if there was some way around this.

🐛 Bug report
Status

Fixed

Version

1.2

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • 🇫🇷France DrDam

    For now, the module makes "copies" of images in order to "force" the core image style generation to process the many time the same image.

    For now, when you flush caches, the module delete all "source-copies", in order to "clean the mess".

    If I would able to detect "unused sources", the clean will be more selective, but i don't figure how do that...

    • b9eeb66e committed on 1.2.x
      Issue #3390497: Performance issues with many images on page
      
  • 🇫🇷France DrDam

    I have rework the flush process, now it only delete "sources-copies" that are not used in a crops, and add an hook_file_delete to cleans crops when a file are deleted ...

    I hope that can fix you issue

  • Status changed to Fixed about 1 year ago
  • 🇨🇦Canada erichomanchuk

    We still have the performance issue. Not sure what can be done but having the image styles deleted on a cache flush or a page save is a performance problem for us on the server. What would be ideal is the images would only be deleted on the image flush command or if the focal point / crop was changed on the field and then only those images would be deleted.

  • Status changed to Postponed: needs info about 1 year ago
  • 🇫🇷France DrDam

    Did you have some technical log ?

  • 🇫🇷France DrDam

    Flushing cache did not delete "derivatives" (create by ImageStyling process) but only "copies of sources" used to make contextual crop working.

    The main goal of media_contextual_crop "copies" are to let ImageStyle processing not touch, so if you flush image style, nothing change.

    The clue are "if a copie exist" (not a derivativ) but not use any more, how can I detect it, and when, and i don't think a cron task will be better.

  • 🇫🇷France DrDam

    hi,

    I have push the deactivation of "copies flush" on cache flush.

    Check 1.2.x dev

  • Status changed to Fixed about 1 year ago
  • 🇫🇷France DrDam

    FIxed in 1.2.2 :
    - cleaning copies have been moved from cache_flush to cron
    - add more cleaning trigger (when original image are deleted)

  • Status changed to Fixed about 1 year ago
Production build 0.71.5 2024