I am working on a gallery-system for a site, and am concerned about performance. Consider the following: I gather images from a multitude of posts into a gallery, and for argument's sake this currently consists of ~300 images at about ~2.5mb each. Offsetting the page-load isn't particularly difficult, I use lazy-loading and compressed thumbnails for that.
However, if I had done some upgrades that required clearing the cache, and someone then visited the gallery page, all ~300 images would need to be re-cached. Even with high execution times, processing and memory limits, this could easily crash both the page and the caching.
What are your thoughts on strategies for resolving this? Ajax would be one approach, but even with preloading this would be a slow process when loading items into the gallery.
Also, could someone elaborate on the Sizes with media queries part of the documentation? I followed the sample there and wrote this:
{{ image.derivatives(640, 1600, 320).sizes('640px, 960px, 1280px', '1600px').url }}
But the returned URL still refers to the original (viewed in a vewport 1030px wide).