Hi Max,
On Mar 29, 2013, at 10:45 AM, Max Semenik maxsem.wiki@gmail.com wrote:
Hi, we at the mobile team are currently working on improving our current hit rate, publishing the half-implemented plan here for review:
== Proposed strategy ==
- We don't vary pages on X-Device anymore.
- Because we still need to give really ancient WAP phones WML output, we
create a new header, X-WAP, with just two values, yes or not[1]
- And we vary our output on X-WAP instead of X-Device[2]
- Because we still need to serve device-specific CSS but can't use device
name in page HTML, we create a single ResourceLoader module, mobile.device.detect, which outputs styles depending on X-Device.[2] This does not affect bits cache fragmentation because it simply changes the way the same data is varied, but not adds the new fragmentation factors. Bits hit rate currently is very high, by the way.
Yes. It does add Vary processing on the bits caches for these requests though. But we can change that by including the X-Device header into the hash for cache lookups, if we want to.
- And because we need X-Device, we will need to direct mobile load.php
requests to the mobile site itself instead of bits. Not a problem because mobile domains are served by Varnish just like bits.
- Since now we will be serving ResourceLoader to all devices, we will
blacklist all the incompatible devices in the startup module to prevent them from choking on the loads of JS they can't handle (and even if they degrade gracefully, still no need to force them to download tens of kilobytes needlessly)[3]
Good work! This should help a great deal.
Your comments are highly appreciated! :)
I've been pondering a bit about the two options for serving mobile ResourceLoader requests with Varnish: on the bits caches or on the mobile caches. I don't fully like either option to be honest. On one hand I'd like to keep mobile device detection off our currently very efficient bits caches, on the other hand I don't like the idea of mixing in the RL requests into the high churn of mobile request LRU cache eviction of the frontend caches. Unfortunately Varnish currently doesn't allow us to separate/specify cache backends for objects well.
So let's go with Asher's suggestion indeed, and add the device detection to the bits servers. Let's keep it such that it'll always be easy to distinguish these requests, so we can easily decide to move these to another Varnish cluster at any point.