Saving and loading content takes way too long when multiple image styles are used

Created on 13 June 2022, almost 3 years ago
Updated 3 May 2023, almost 2 years ago

Problem/Motivation

During evaluating this module for a news website we experienced serious slowdowns on node and media pages when dealing with multiple images.

Steps to reproduce

1. set one image field to have multiple values and GCS as storage. Also, for faster testing, you can disable the required alt field.
2. set an image style or responsive image style for displaying the image field value.
3. upload at least 10 images. (this is the first place where the slowdowns occur)
4. click save.

After clicking save the user is redirected to the canonical node page, so the image styles are generated (probably). The user has to wait until every image is generated to get a response from the server. This takes more than 30 seconds sometimes. If a site has responsive image styles, then this process will run even longer because of the multiple image styles for multiple breakpoints. Also, if someone generates jpg and webp variants (with imageapi_optimize_webp), then again this needed time multiplies until infinity.

Proposed resolution

Think through that should this be the default behavior or not. Add possibility in the settings to generate image styles on the fly after the page HTML is loaded with some lazy-loading mechanism. The s3fs module tries to solve this by generating a different URL while the generated image doesn't exist.

We could use image_style_warmer to process specific styles later. But that could ruin the editorial experience if the content editors could not see the uploaded images in CKEditor and on the article pages immediately.

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡ΈπŸ‡°Slovakia kaszarobert

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