Idea: asynchronously load images from GCS #51105

Open
opened 2017-04-01 12:36:08 +02:00 by Sybren A. Stüvel · 5 comments

This is just an idea. Logging in to the cloud is slow, and I think that's partially because of the images on the activity stream. Other not-so-often visited pages with many images (such as some texture groups) are also very slow to load. I was thinking, maybe it's a good idea to not refresh the URL at GCS when the HTML loads. Instead, we use a placeholder image for all images with expired links, and put the file ObjectID into a data attribute. Then some JavaScript can asynchronously fetch all those from our server from a special end-point that'll refresh the URLs.

Of course we'll have to think about the security implications for this. Maybe using the file ObjectID is a bad idea, because it's too easy to guess other IDs. A special endpoint serving files by ObjectID will allow a user to simply increment the ObjectIDs until files from someone else's project are returned.

Still, I think it's worth thinking about, as it may give a significant (perceived) speedup of the cloud.

This is just an idea. Logging in to the cloud is slow, and I think that's partially because of the images on the activity stream. Other not-so-often visited pages with many images (such as some texture groups) are also very slow to load. I was thinking, maybe it's a good idea to *not* refresh the URL at GCS when the HTML loads. Instead, we use a placeholder image for all images with expired links, and put the file ObjectID into a data attribute. Then some JavaScript can asynchronously fetch all those from our server from a special end-point that'll refresh the URLs. Of course we'll have to think about the security implications for this. Maybe using the file ObjectID is a bad idea, because it's too easy to guess other IDs. A special endpoint serving files by ObjectID will allow a user to simply increment the ObjectIDs until files from someone else's project are returned. Still, I think it's worth thinking about, as it may give a significant (perceived) speedup of the cloud.

Changed status to: 'Open'

Changed status to: 'Open'

Added subscribers: @dr.sybren, @fsiddi, @pablovazquez

Added subscribers: @dr.sybren, @fsiddi, @pablovazquez

Would be great to somehow retrieve or the height/width of the file so the placeholders don't break the layout. In most cases we know the size of thumbnails (group view, frontpage), but when the images are responsive we don't.

Would be great to somehow retrieve or the height/width of the file so the placeholders don't break the layout. In most cases we know the size of thumbnails (group view, frontpage), but when the images are responsive we don't.

The sizes are stored in the file document, which needs to be accessed anyway to figure out whether links are outdated or not. I'm sure we can get those values into the Jinja template context.

The sizes are stored in the file document, which needs to be accessed anyway to figure out whether links are outdated or not. I'm sure we can get those values into the Jinja template context.

Changing to low prio since we have a Celery task that actively refreshes expired links.

Changing to low prio since we have a Celery task that actively refreshes expired links.
Sign in to join this conversation.
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: archive/pillar#51105
No description provided.