Closed Bug 1071468 Opened 10 years ago Closed 10 years ago

Commonplace HTML pages should be cached a few minutes

Categories

(Marketplace Graveyard :: Consumer Pages, defect, P4)

defect

Tracking

(Not tracked)

VERIFIED FIXED
2014-11-04

People

(Reporter: mat, Assigned: mat)

References

Details

(Keywords: perf, Whiteboard: [repoman])

Currently we cache API responses and CSS/JS files but not commonplace HTML pages (/, /statistics/, /curate/, /discovery/ etc). We already have ETags, but having also a Cache-Control: max-age={xxx} would allow browsers to not even send us a request for {xxx} seconds, improving performance for repeat views.

We should add a Cache-Control: max-age={xxx} directive, even for less than 3 minutes if necessary. Downside would be, when we deploy, there could be a small window where we still see the old content (so the caching duration should be small).

In addition, we should do the same for our iframes (potatolytics.html & iframe-install.html), caching them even longer and use the build_id or something similar in the query string to bust the cache.
This worries me because we will be referencing old CSS+JS bundles for 3 minutes. I can see that being a headache for people. Maybe you could allow `?cache=0` to bypass the cache.

IMO we could probably get better returns if we fixed our caching techniques. We still have lots of perf bugs open:

    https://wiki.mozilla.org/Marketplace/Performance_optimization#Performance_bugs_.28general.29
Why would it be a problem to reference old bundles for 3 minutes ? You'd be consistent, always using the right HTML with the right JS+CSS. And you'd be able to shift+reload (or pass any query string) to bypass that when necessary, since it's not cached by a CDN/Reverse Proxy.
(In reply to Mathieu Pillard [:mat] from comment #2)
> Why would it be a problem to reference old bundles for 3 minutes ? You'd be
> consistent, always using the right HTML with the right JS+CSS. And you'd be
> able to shift+reload (or pass any query string) to bypass that when
> necessary, since it's not cached by a CDN/Reverse Proxy.

Oh, right. That's a non-issue then. I forgot only when we're serving from the CDN is that a problem.

+1 to this then.
Priority: -- → P4
Assignee: nobody → mpillard
Whiteboard: [repoman]
Status: NEW → ASSIGNED
Fixed in https://github.com/mozilla/zamboni/commit/449df5910fef3ad083fbfde9927ff1e51590b946

STR:
- Open marketplace homepage with developer tools network tab opened
- Verify that the HTML response for "/" contains "Cache-Control: max-age=180" in the response
- While you're still on the homepage, focus your location bar, directly hit enter to simulate a new visit (don't use reload button)
- Verify that no request is made for the HTML, as it should be in cache for 180 seconds.
- Repeat after more than 3 minutes, you should see the request for the HTML.
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → 2014-11-04
Verified as fixed in https://marketplace-dev.allizom.org/ on FF36 (Win 7).
Closing bug.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.