deliciousbrains / wp-amazon-s3-and-cloudfront

Automatically copies media uploads to Amazon S3 for delivery. Optionally configure Amazon CloudFront for even faster delivery.
https://wordpress.org/plugins/amazon-s3-and-cloudfront/
312 stars 150 forks source link

Media Library loads exceptionally slow [grid view only] #626

Closed ChristophJeworutzki closed 1 year ago

ChristophJeworutzki commented 1 year ago

HI 👋,

We have a project with nearly 18k attachments offloaded [Amazon S3, EU (London), Cloudfront Custom Domain Name] I noticed that the media library loads exceptionally slow (<10s). This only happens in the grid view of the media library (/wp-admin/upload.php?mode=grid). I did some investigation and could narrowd down the issue to this filter hook:

https://github.com/deliciousbrains/wp-amazon-s3-and-cloudfront/blob/bf73f7a79b0432cf60195aacd55fefff98291a88/classes/as3cf-plugin-compatibility.php#L95

If I comment out this line, the media library loads quickly again.

It seems to be related to the S3 stream wrapper. I know this is for compatibility with plugins when attachments are removed from the local server after upload (which is the case). But why does it slows down the media library grid view?

Maybe you could point us in the right direction to solve this issue in a way.

ianmjones commented 1 year ago

Hey @ChristophJeworutzki,

You've likely got a plugin or theme installed that dynamically resizes, crops or otherwise processes image thumbnails rather than properly register and create the thumbnails. It may even create those thumbnails but then still process them in some way on every grid display.

For further support, please raise a request at https://wordpress.org/support/plugin/amazon-s3-and-cloudfront or if you have a WP Offload Media license please use the "Support" tab in the plugin.