In T66214, we are working on designing an official thumb API, which should let clients select common options like the size of the thumbnail. We expect the introduction of such an API to involve a long transition period, so we need to prepare solutions that let us avoid fragmenting caches during the transition period & beyond.
Concretely, the Varnish / CDN related questions are these:
- Query string normalization: Most discussion participants favor using regular query strings to specify thumb parameters. To avoid cache fragmentation, we would want to normalize query string order in Varnish, as discussed in T138093. Is supporting query string parameter order normalization in Varnish 4 feasible in the foreseeable future?
- General redirect following support in Varnish: During the transition period, we will need to rewrite thumb URL formats to avoid cache fragmentation. Supporting this including all features in Varnish is not feasible, so this should be handled by backend code. One possibility is to return HTTP redirects from the backend service. However, returning those to clients would introduce a latency penalty, especially on high-latency connections. To avoid this, it would be interesting to follow this redirect (possibly triggered by specific response headers) in Varnish on behalf of the client. Does this sound sane / feasible to you?
- Rewrite simple thumbnails in Varnish: Most thumbnails have no custom parameters except for the size. As an optimization, we could thus speed up the processing of the vast majority of thumb requests by supporting limited rewriting of *simple* thumb URLs only in Varnish. The downside is extra complexity.