Problem/Motivation

I ran analysis about page generation. A page load with 15 s3 styled image is extrem slow! Checking every file in cloud needs a lot time.

Problem

Proposed resolution

We should maintain a db table + cache layer to improve performance.
fid|style_id|state

In GetExternalUri() we can check cache first, then db, then in cloud.

Need to update db table on

  • hook_file_move
  • hook_file_delete
  • hook_image_style_flush

What do you think? If you ok with it, I can do until next week.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

szantog’s picture

Issue summary: View changes
Status: Active » Needs review
FileSize
5.85 KB

Here is the first patch. I'll try it on live site soon. (I mean our dev environment of our live site. :))
Meanwhile I figured out the proper hooks to manage db table.

szantog’s picture

Issue summary: View changes
szantog’s picture

Issue summary: View changes
szantog’s picture

Fixed wrong condition of db checking, added new cache table to flush_caches.

deviantintegral’s picture

Status: Needs review » Needs work

I'm a little confused by this. The S3 SDK already has a metadata cache built in. Is that not being hit for the file_exist calls? Have you disabled the metadata cache on the settings screen? It should be enabled by default.

deviantintegral’s picture

Title: Improve image style handling » Add a cache for image style file_exists() calls