AMP_CONFIG variable for Google SafeFrame version
Under some circumstances, Fast Fetch renders creatives into a Google SafeFrame. When Google updates the SafeFrame version that it uses in GPT, then it becomes out of sync with the one used in Fast Fetch, which makes cache misses more likely (since the version used in GPT is likely to already be cached in users' browsers). Currently, the version number is a hardcoded constant in amp-a4a.js, which means that any change requires the full two-week runtime release cycle. It would be better to put it into AMP_CONFIG, since config-only changes are allowed to be released outside of the runtime release cycle. This would allow updates to propagate much more quickly.
@ampproject/a4a
Is it just about cache miss? In fact, I think an older version might have higher cache hit rate during the migration time period right?
since config-only changes are allowed to be released outside of the runtime release cycle
This isn't true, config changes require a whole new binary to be pushed.
This isn't true, config changes require a whole new binary to be pushed.
Still a bit faster.
But honestly, I still don't understand the benefits here.
How is it faster? Still requires a cherry-pick, new release branch, full compile, push, promotes. Everything is the same except the file that changes.
My understanding was that it was a process issue; config flag changes are allowed to be pushed into production without waiting for the next canary cut, which means we don't have to wait two weeks to see the results. Is this not the case?
Adding @keithwrightbos since this was all his idea.
config flag changes are allowed to be pushed into production without waiting for the next canary cut
Ahh, yes, I hadn't thought of that. As long as you're not looking for emergency patches (my comments above), this will be a week faster.
Safeframe is used by GPT and thus throughout the mobile web. Having the same version will greatly increase the probability of being in cache. This is especially important as its used for iOS which does not support preload so we can't fetch it in advance of render (unless we're ok with creating an iframe src=
One other option which I will explore is to return the safeframe version to use as part of the ad response.
Honestly I doubt this will improve the cache hit rate. In fact, the late we change the version, the better chance we hit the cache for the new version. Isn't it?
The point is that SafeFrame is used extensively outside of AMP. So it's highly likely that the user will have the new SafeFrame in browser cache just from non-AMP browsing. But if we allow the version used by Fast Fetch to fall too far out of date, then it will be more likely to be a cache miss, since the only source for it will be AMP page views, not (AMP page views + all other page views).
The point is that SafeFrame is used extensively outside of AMP. So it's highly likely that the user will have the new SafeFrame in browser cache just from non-AMP browsing. But if we allow the version used by Fast Fetch to fall too far out of date, then it will be more likely to be a cache miss, since the only source for it will be AMP page views, not (AMP page views + all other page views).
That's a fair point, if SafeFrame is almost guaranteed to be used outside AMP first.
One other option which I will explore is to return the safeframe version to use as part of the ad response.
I actually like this idea. One step further, we can let ad response decide the whole frame URL. We can default to AMP name frame. Not sure what's the security implication though.
This doesn't work as nicely as you might be envisioning, because we'd still need runtime logic for each possible name format. NameFrame just uses the entire creative text as the name, but SafeFrame does something more complicated with a multipart string.
At any rate, this is all supposed to be temporary, we want to support NameFrame as the only rendering option for non-AMP creatives eventually. (Nobody outside Google has come forth with any requests for any kind of custom rendering support, as far as I'm aware.) It's just we can't have too many things in flight at once since this is a revenue-critical system.
Merging into single option sounds great.
@dvoytenko do we envision AMP_CONF to be used for 3rd party config? That's my only concern. It can reduce our future flexibility on this config, because so far this config is purely for our own experiment flags.
On the other hand, the improvement from this proposal seems really tiny to me (Cutting 2wk to 1wk). Meantime, the version upgrade seems to be a rare thing (2 times in the past year?). Most of the delay is probably man made (we are 2 versions late). Or are you going to build a automatic sync tool? Overall, I'm not sure if the benefit from this proposal outweighs the benefits we're getting.
This is really not a very good example of "third-party config". Every Fast Fetch ad network uses this. It's currently the case that, through an accident of development history, a universal-in-principle AMP component happens to depend on this particular bit of third-party infrastructure. Hopefully that'll change at some point soon as we find a way to eliminate the dependency.
SafeFrame changes have historically been relatively infrequent. We're unlikely to build an automatic sync tool.
@keithwrightbos, is the purpose here just to reduce average latency from cache misses? Are there specific concerns that this makes statistical analysis difficult by introducing a confounding variable? Or is there something else?
@lannka
@dvoytenko do we envision AMP_CONF to be used for 3rd party config? That's my only concern. It can reduce our future flexibility on this config, because so far this config is purely for our own experiment flags.
AMP_CONFIG is currently only for 1p needs. It's update latency, per request, can be as low as 1hr.
Resolved via #9360