Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Updated: Comment #39
Problem/Motivation
The note about the page cache module on the performance page is confusing, it looks like this only applies for the internal page cache module, but it doesn't.
Proposed resolution
Update the UI text to be more clear.
Remaining tasks
None.
User interface changes
Update the UI text to be more clear.
API changes
None.
Comment | File | Size | Author |
---|---|---|---|
#39 | with-patch-no-module.png | 112.38 KB | borisson_ |
#39 | with-patch-and-cachemodule.png | 121.18 KB | borisson_ |
#39 | before.png | 123.55 KB | borisson_ |
#38 | Screen Shot 2018-03-12 at 12.22.26.png | 141.72 KB | alexpott |
#38 | 2216161-38.patch | 3.99 KB | alexpott |
Comments
Comment #1
Wim LeersEt voila!
Comment #2
Bojhan CreditAttribution: Bojhan commentedLooks good to me! I'd say RTBC if it comes back green :)
Comment #4
Wim Leers1: internal_page_cache_checkbox_states-2216161-1.patch queued for re-testing.
Comment #6
Wim Leers1: internal_page_cache_checkbox_states-2216161-1.patch queued for re-testing.
Comment #7
znerol CreditAttribution: znerol commentedI do not agree that this is useful. In Drupal 7 it was possible to use the internal cache without having to set Page cache maximum age. In my opinion this is a regression and #2177461: Refactor page caching into a service addresses that.
Comment #8
Wim Leers#7: Interesting! So what does the "internal page caching" setting do if page caching itself is enabled? If you can point me to docs, that's fine too.
Comment #9
znerol CreditAttribution: znerol commentedUse internal page cache is the checkbox formerly used to enable the page cache. I found where the regression was introduced: #1853086: Remove cache.page.enabled in favor of an explicit internal cache setting. The problem is this hunk:
Comment #10
Wim Leers#9: are you saying that even if *no* max-age is configured, page caching should be possible? If so, could you explain the rationale behind that?
Comment #11
znerol CreditAttribution: znerol commentedIn Drupal 7 it was necessary to enable internal page caching in order make external page caching work. This is admittedly nonsense. In Drupal 8 the nonsense was just reversed and now internal page caching is only possible when external caching is configured.
In my opinion those two things simply do not need to be coupled together.
Comment #12
Wim LeersI disagree with #11.
The "maximum age" setting serves *two* purposes:
Cache-Control
/Expires
headers, which you could indeed call "external page caching". It's about informing the browser how long it may cache this page (but also a reverse proxy cache between the server and the browser) .expire
column in the internal page cache, if internal page caching is enabled.How does page caching make sense unless you can cache it only 0 seconds? Because that's precisely what "enable internal page caching but don't set a maximum age" implies.
Or am I missing something?
Comment #13
znerol CreditAttribution: znerol commentedI agree with 1. However 2 does not match the current implementation. The maximum age setting does not have any influence on the expire-setting of the cache-object. It is true that drupal_page_set_cache will set the expire-attribute of the cache-object to a custom timestamp, but it will only do it if the Expire header was set by a custom module (core only sets it in drupal_serve_page_from_cache which comes after the cache object was saved). Normally the expire-attribute of the cache-object is set to
CACHE_TEMPORARY
(D7) andCache::PERMANENT
(D8) respectively.Also I'd like to point out that it may be desirable to specify different expire-values for internal and external caches when delivering directly to the browser (no reverse-proxy). The internal cache should be as long living as possible, because we can purge it if necessary, while the external ttl should be set to a lower value on sites with frequent updates.
Comment #14
Wim Leers#13 A
2 does indeed not match the current implementation — I noticed that right after commenting — but isn't that a bug? Because:
actually should should do just that, but it's failing because Drupal core does
instead of using Symfony's
addCacheControlDirective()
method.#13 B
This I agree with, but only once #2124957: Replace 'content' cache tag with 'rendered' and use it sparingly is fully fixed.
And this then is completely broken also, because the maximum age you configure on the performance settings page is only set when a page is served from cache! This is also why it's named in a page cache-specific way.
So… as per #13 B, you've convinced me that the change I'm proposing in this issue does not make sense. However, if that's the case, we must still improve the usability of these settings, because right now it's very confusing. And we need to ensure caching is allowed on almost all pages (the exception being only admin pages?).
What do you think about this?
Comment #15
znerol CreditAttribution: znerol commentedI would rather get rid of the Use the actual timestamp from an Expires header, if available. business. It does not make much sense to bind the expiry-attribute of the internal cache to any of the Expire / Cache-Control headers of the response.
No, that is actually not the case. On a cache-miss
drupal_page_set_cache
returns the cache-object and that is sent just like a cache-hit usingdrupal_serve_page_from_cache
where the headers are applied. This is actually where the tight coupling between internal and external cache is coming from.Regarding the new proposal: I like it very much. Setting
Cache-Control: max-age
is not only necessary for turning on the browser cache but also for operation behind a reverse proxy. This should be specified more explicit.Comment #16
Wim LeersI agree with the theory, but disagree in practice: if you have things like "X minutes ago" text or "weather in the past 5 minutes" etc, then it makes total sense that the page cache should be refreshed as well.
Sorry, I misphrased. I wanted to say: "The maximum age you configure on the performance settings page is only set when internal page caching is enabled!". Of course it happens on both cache misses and cache hits.
Yay :)
While it's true that that's also relevant/applicable to reverse proxies, I think that "reverse proxy" is too scary for "the 90%". Those who use a reverse proxy will surely already understand this, without needing that to be called out specifically. That's why I omitted it.
Any other thoughts for the new proposal?
Comment #17
znerol CreditAttribution: znerol commentedMaybe this could work in the description text:
The maximum time a page may be cached by a browser or a proxy server.
Comment #18
Wim Leers#17: Sounds good.
Anything else?
Comment #19
znerol CreditAttribution: znerol commentedA patch to review? :)
Comment #20
nielsvm CreditAttribution: nielsvm commentedI'm *big favor* of getting this in, we should better protect our users against the tight relation between these two settings. Hopefully that will also reduce the amount of sites running without internal page caching that don't have a internal cache/rproxy in front of them. This often fuels competitors with the "Drupal is slow" argument so moving more towards "fast by default" (or almost default with hiding the checkbox at none) is better.
I've been testing #2124957 and related sub issues recently and with that shaping well up this is all becoming more and more important, as the internal page cache will be "less in the way" and less of a irritation to site users but something that just works and should be enabled as much as possible.
Niels
Comment #21
Wim LeersThis is not a focus issue, so untagging "sprint". We have higher priority things to deal with first.
Comment #22
znerol CreditAttribution: znerol commentedMaking this a sub-issue of #2257695: [meta] Modernize the page cache.
Comment #23
LewisNymanComment #24
moshe weitzman CreditAttribution: moshe weitzman commentedOpen for anyone to move ahead as Wim has other focus issues these days.
Comment #25
znerol CreditAttribution: znerol commentedExternal cache (adding
Cache-Control
header) is now separated from the internal cache, see #2257709: Remove the interdependence between the internal page cache and management of the Cache-Control header for external caches. The settings should be updated to reflect this.Comment #26
jhedstromReroll of #1.
Comment #27
Berdir#2368987: Move internal page caching to a module to avoid relying on config get on runtime is going to remove a few options from that page.
Comment #28
BerdirThis is how the page looks now.
No idea if there's still something to simplify or improve?
Comment #29
BerdirComment #30
Wim LeersSince #27/#2368987: Move internal page caching to a module to avoid relying on config get on runtime, the IS is confusingly outdated.
Comment #31
msonnabaum CreditAttribution: msonnabaum commentedI tried to read up on this issue (since I was the one who made the change being objected to here), but this issue is all over the place now. Maybe someone could start a new, more focussed issue for the problem being solved and proposed solution?
Comment #37
alexpottI think there is still stuff to do here. The description which says
is largely irrelevant because this setting has nothing to do with that. It only affects the headers that are outputted from Drupal. Additionally we have a clash of terminology because we're setting the
value and this has nothing to do with the internal page cache module.
Comment #38
alexpottHere's a patch that changes the Page cache title to
so there can be no confusion and only displays something about the Internal Page Cache module if it is not installed.
Link to screenshot of what it now looks like when page_cache is not installed: https://www.drupal.org/files/issues/2018-03-12/Screen%20Shot%202018-03-1...
Comment #39
borisson_Updated the Issue summary.
This is the current page:
This is how it looks after the patch is applied
With the page cache module enabled.
With the page cache module not installed.
Comment #40
alexpott@borisson_ I think you might have the
and
images around the wrong way.
Comment #41
borisson_#40, I did! Thanks! Sorry. Edited the comment to fix the order.
Comment #42
catchNice to see small UI cleanups like this happening.
Committed 2f1a5b3 and pushed to 8.6.x. Thanks!