Improve performance when generating image style urls

Created on 25 March 2022, over 3 years ago
Updated 7 July 2025, about 1 month ago

We've found that the requests containing image style urls, have a degraded performance. Even after the image style has been generated.

This is due to the check to see whether the resized image exists:
https://git.drupalcode.org/project/flysystem_s3/-/blob/9d8f970f5704d1b51...
This makes a connection to S3, and on a page with lots of images, this can increase load times significantly (we found around 20-30%).

Obviously the first time an image style is requested, it needs to be generated. So the module needs to know when it it should generate the image style (hence the check). But after this is done the check could be seen as unnecessary.

Possible solutions:

  • Store a record of what image styles have been generated, for each image. This could either be in a cache table or possibly somewhere on the file entity itself.
  • Pre-generate the image styles another way, so that we can assume the image exists when the url is being generated.
✨ Feature request
Status

Needs work

Version

2.0

Component

Code

Created by

πŸ‡¬πŸ‡§United Kingdom leon kessler

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

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024