New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

amp-fresh #4191

Closed
erwinmombay opened this Issue Jul 25, 2016 · 20 comments

Comments

@erwinmombay
Member

erwinmombay commented Jul 25, 2016

The cache operates on a stale-while-revalidate model. This means that a document when viewed by a user on the client could be stale as revalidation only happens in the background and effects subsequent page views. While this is acceptable for most content, some sections of a page are critical or sensitive enough that it warrants always having the latest piece of information such as item pricing and rating. A good example of this scenario is in e-commerce and long tail product pages which might not be visited often but should have the correct price or quantity remaining when viewed.


Will post design doc shortly.

@ericlindley-g ericlindley-g added this to the Current milestone Jul 28, 2016

@ericlindley-g

This comment has been minimized.

Collaborator

ericlindley-g commented Jul 28, 2016

@erwinmombay — Calling this "Current", but please update if that's not quite right. Thanks!

@jpettitt

This comment has been minimized.

Collaborator

jpettitt commented Sep 22, 2016

Is this essentially a one time amp-live-list?

@erwinmombay

This comment has been minimized.

Member

erwinmombay commented Sep 22, 2016

@jpettitt the mechanism is, but as far as usage this component is really for an edge case for long tail pages wherein a 1 behind copy from the cache would be bad (like a 1 year old e-commerce page being the user's first landing experience and has super stale quantity count). Will add more documentation soon

@Gregable

This comment has been minimized.

Member

Gregable commented Sep 22, 2016

Why not just use standard HTTP expiry headers for communicating this information to the AMP Cache, rather than an HTML tag?

@jpettitt

This comment has been minimized.

Collaborator

jpettitt commented Sep 23, 2016

Hmm, I knew the cache only took max-age as a hint. However you're saying it doesn't support stale-while-revalidate ? Is there some max ttl or could things theoretically persist forever?

Which error conditions cause the cache to invalidate? If it gets a 404 or 410 I know it drops the doc. What about 5xx codes?

@jridgewell

This comment has been minimized.

Member

jridgewell commented Sep 23, 2016

Why not just use standard HTTP expiry headers for communicating this information to the AMP Cache, rather than an HTML tag?

Our stale-while-revalidate would cause bad data to be shown while we refetch.

@adelinamart

This comment has been minimized.

Collaborator

adelinamart commented Feb 7, 2017

What's the latest status here? Thanks.

@ericlindley-g

This comment has been minimized.

Collaborator

ericlindley-g commented Feb 18, 2017

Still very important—#7463 may address the primary use cases for this. Will definitely want to keep both top-of-mind.

@ericlindley-g ericlindley-g added this to Backlog (shortlist) in UI Feb 21, 2017

@cramforce

This comment has been minimized.

Member

cramforce commented Mar 1, 2017

#7463 isn't really a replacement for amp-fresh, but #7907 would address the majority of use cases.

@ericlindley-g ericlindley-g moved this from Backlog (shortlist) to Backlog in UI Mar 30, 2017

@jpettitt

This comment has been minimized.

Collaborator

jpettitt commented Jul 10, 2017

Any status update on this? We'd like to implement it for school closings / weather on pages where we can't use amp list.

@ericlindley-g

This comment has been minimized.

Collaborator

ericlindley-g commented Jul 10, 2017

Thanks for checking in, @jpettitt — Current thinking includes the feature described by @choumx in this issue: #9862 Can you say if that feature would fit your needs?

@erwinmombay

This comment has been minimized.

Member

erwinmombay commented Jul 10, 2017

i believe this has been replaced by amp-bind + amp-state mechanism right @ericlindley-g ? i believe features that amp-fresh would have provided have been covered by amp-bind + amp-state

@ericlindley-g

This comment has been minimized.

Collaborator

ericlindley-g commented Jul 10, 2017

That's right, in part: there are a few ways that we're working to address recency in AMP. One is the amp-bind + amp-state mechanism, where amp-state can pull in fresh data at load time. Another is the amp-fresh-like behavior described in #9862

@erwinmombay

This comment has been minimized.

Member

erwinmombay commented Jul 10, 2017

i'll remove the code for amp-fresh and its docs

@ericlindley-g

This comment has been minimized.

Collaborator

ericlindley-g commented Oct 18, 2017

Closing this based on features mentioned above that fill the need, but please chime in if your use case for fresh data in AMP pages isn't covered yet (/cc @lswang1618 )

@ericlindley-g ericlindley-g removed this from Backlog in UI Jan 5, 2018

@alankent

This comment has been minimized.

alankent commented Apr 11, 2018

What about seasonal themes? During Christmas, I make significant changes to the CSS and look of the site to make it feel more seasonal. The CSS is in the AMP page, not fetched via amp-bind/amp-state etc. To stop Christmas themed pages coming up for tail products later, I think it would be useful for a site to control the stale-while-revalidate timeout. E.g. a site might set it to a value like a few days so seasonal themes cannot last too long in the cache (or set it based on how many days before Christmas so they all time out exactly on Christmas eve).

@ericlindley-g

This comment has been minimized.

Collaborator

ericlindley-g commented Apr 11, 2018

That a good use case to cover — I think the solution would be to fix this directly in a given AMP Cache. My assumption is that the existing update-cache request for the Google AMP Cache would trigger a fetch on too many pages at once for some merchants to be practical (?)

@alf7 and @rudygalfi for thoughts

@cramforce

This comment has been minimized.

Member

cramforce commented Apr 11, 2018

The update cache API is the way to go. Merchants can throttle requests so it doesn't overwhelm themselves.

@alankent

This comment has been minimized.

alankent commented Apr 11, 2018

First, yes, if a ecomm site had 1M SKUs, that would be 1M update-cache requests.

But more importantly, you are assuming the Google AMP Cache is the only cache. A merchant should not have to know what caches have been implemented. Making the merchant responsible to set a stale-while-revalidate (or max-stale or whatever) timeout header is fine, but asking them to keep an up to date list of caches seems "wrong".

@cramforce

This comment has been minimized.

Member

cramforce commented Apr 11, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment