Page MenuHomePhabricator

Improve handling of mobile variants in Varnish
Closed, ResolvedPublic

Description

Our current strategy for varying the cache on cookie values is to check the cookie header for specific cookies which we know are significant to the final output. When the cookie header contains a cache-relevant cookie, we treat the request as un-cacheable.

On desktop, only token or session cookies are considered relevant. We explicitly don't want to cache logged-in page views, so this is OK.

On mobile, the situation is different. We have two additional cache-relevant cookies — disableImages and optin. Both of these have a small set of possible values (disableImages may be "1" or blank; optin may be "alpha", "beta" or "stable"). Both of these cookies represent preferences that can be set by anonymous users. Anon requests that have one or both of these cookies set can and should enjoy a high cache hit-rate, but at the moment they bypass the cache entirely. This is especially regrettable in the case of disableImages, which is presumably set by bandwidth- and latency-conscious users.

The way we handle these cookies (and soon also the NetSpeed cookie, proposed in T119797) should be different from the way we handle session and token cookies. Requests which set one or more of these cookies should be looked up in the cache.

Details

Related Gerrit Patches:
operations/puppet : productionImprove handling of disableImages cookie
mediawiki/extensions/MobileFrontend : wmf/1.27.0-wmf.7Improve disableImages cookie code
mediawiki/extensions/MobileFrontend : masterImprove disableImages cookie code

Event Timeline

ori created this task.Dec 2 2015, 11:57 PM
ori raised the priority of this task from to Needs Triage.
ori updated the task description. (Show Details)
ori added subscribers: ori, BBlack, faidon.
Restricted Application added subscribers: StudiesWorld, Aklapper. · View Herald TranscriptDec 2 2015, 11:57 PM
ori set Security to None.Dec 5 2015, 12:05 AM
ori added a subscriber: Tnegrin.
fgiunchedi triaged this task as Normal priority.Dec 7 2015, 2:44 PM
fgiunchedi edited projects, added Operations, Traffic; removed Varnish.

Hi Adam -- we should review this "soon" as it potentially impacts users who are trying to increase page performance by not downloading images but have the additional undesirable effect of disabling the cache.

thanks,

-Toby

mark added a subscriber: mark.Dec 7 2015, 3:16 PM
ori added a comment.Dec 7 2015, 6:01 PM

Even more amazing: when the 'disableImages' cookie is unset, it is not actually cleared; instead it is simply set to a blank value. This means that changing the preference either way condemns the user to 180 days of cache misses.

Change 257375 had a related patch set uploaded (by Ori.livneh):
Improve disableImages cookie code

https://gerrit.wikimedia.org/r/257375

Gents, just acknowledging I saw this task. I'll tag this with Reading-Admin. @JKatzWMF, @Jdlrobson is this eligible for the current sprint or does it need to wait until the next sprint?

@Yurik, we'll need to analyze the ZeroOpts cookie. Gut feeling is it isn't necessary anymore, but we should verify and also discuss with @DFoy in case any changes are needed in the actual per-operator configs themselves.

dr0ptp4kt moved this task from Backlog to Next Up on the Reading-Admin board.
ori added a comment.Dec 7 2015, 7:16 PM

I think the disableImages feature is a misfeature, at the end of the day.

(a) It never worked properly.
(b) Every modern graphical browser can disable images.

JKatzWMF added a comment.EditedDec 7 2015, 7:38 PM

@dr0ptp4kt I think this needs to wait at least until next sprint, as we have a full load and it sounds like there are still some unknowns/blockers

Ugh, ignore ^. In a rush and thought this was something else. Do we know how many users this impacts?

If people turn it on, then off, will we be able to count them?

Change 257375 merged by jenkins-bot:
Improve disableImages cookie code

https://gerrit.wikimedia.org/r/257375

Change 257486 had a related patch set uploaded (by Ori.livneh):
Improve disableImages cookie code

https://gerrit.wikimedia.org/r/257486

Change 257486 merged by jenkins-bot:
Improve disableImages cookie code

https://gerrit.wikimedia.org/r/257486

Change 257491 had a related patch set uploaded (by Ori.livneh):
Improve handling of disableImages cookie

https://gerrit.wikimedia.org/r/257491

ori closed this task as Resolved.Dec 8 2015, 6:29 PM
ori claimed this task.

Fixed.

Change 257491 abandoned by BBlack:
Improve handling of disableImages cookie

Reason:
Already done in I686de38fee

https://gerrit.wikimedia.org/r/257491

BBlack moved this task from Triage to Done on the Traffic board.Dec 11 2015, 4:23 PM