Page MenuHomePhabricator

Determine http cache control and active purging for REST endpoints serving parsoid output
Open, HighPublic

Description

The page/html and page/revision endpoints serve HTML generated by parsoid. We need to determine how we want the web cache layer and client side http cache to handle this data.

When storing parsoid output in the parser cache, we need to set an appropriate cache expiry time, taking into account any dynamic content embedded in the input (compare ParserOutput::getCacheExpiry).

This cache expiry time should also be use for the Cache-Control header of the HTTP resonse, together with expiry info coming from RevisionContentHelper to account for supressed (private!) revisions. (make sure we are converting correctly between absolute time stamp and remaining seconds). We should also send the must-revalidate flag.

NOTE: cache expiry is currently hard-coded to 5 seconds in PageContentHelper. This is probably because we wanted to avoid the need for active purging.
NOTE: Consult with the traffic team about cache duration and active purging! The cache control header currently received from RESTbase (via varnish) is: s-maxage=1209600, max-age=0, must-revalidate.
NOTE: We probably want to mark the stashed flavor (etag has /stash at the end) as non-cacheable, to avoid duplicate cache entries. we will also have to differentiate between plain HTML and HTML in a JSON wrapper.

Event Timeline

daniel renamed this task from Determin cache expiry for parsoid output to Determin http cache control and active purging for REST enpoints serving parsoid output.May 23 2022, 10:52 AM
daniel updated the task description. (Show Details)
daniel unsubscribed.
DAlangi_WMF renamed this task from Determin http cache control and active purging for REST enpoints serving parsoid output to Determine http cache control and active purging for REST endpoints serving parsoid output.May 23 2022, 10:57 AM
daniel triaged this task as High priority.May 24 2022, 8:00 AM

@DAlangi_WMF we talked about this the other day, can you sahre your findings here?