Problem/Motivation

The internal page cache still cannot be swapped out easily.

Proposed resolution

Move the remaining procedural code from the following functions to the page cache stack middleware. Also move the code responsible for storing a page in the internal cache from FinishResponseSubscriber to the new middleware.

Remaining tasks

User interface changes

None.

API changes

Removed functions:

  • drupal_page_cache_get_cid()
  • drupal_page_get_cache()
  • drupal_page_set_cache()
  • drupal_serve_page_from_cache()
  • DrupalKernel::handlePageCache()

Removed DRUPAL_BOOTSTRAP_PAGE_CACHE.

Beta phase evaluation

Reference: https://www.drupal.org/core/beta-changes
Issue category Task
Issue priority Major because of contrib page level caches like Boost and Authcache dependencies
Disruption Disruptive for contributed and custom modules because it will require an internal refactoring after commit

Follow-up to #2257695: [meta] Modernize the page cache

CommentFileSizeAuthor
#66 interdiff.txt826 bytesznerol
#66 2348679-move-page-cache-to-stack-middleware-66.patch29.17 KBznerol
#64 interdiff.txt850 bytesznerol
#64 2348679-move-page-cache-to-stack-middleware-64.patch29.15 KBznerol
#62 interdiff.txt1.83 KBWim Leers
#62 2348679-move-page-cache-to-stack-middleware-62.patch29.2 KBWim Leers
#61 interdiff.txt440 bytesznerol
#61 2348679-move-page-cache-to-stack-middleware-61.diff28.73 KBznerol
#58 2348679-move-page-cache-to-stack-middleware-55.diff28.67 KBznerol
#55 2348679-move-page-cache-to-stack-middleware-55.diff28.67 KBznerol
#55 interdiff.txt1.96 KBznerol
#51 2348679-move-page-cache-to-stack-middleware-51.diff29.26 KBznerol
#51 interdiff.txt444 bytesznerol
#42 mockcache-ab-lazy-response-policy.txt1.53 KBznerol
#39 interdiff.txt2.57 KBznerol
#39 2348679-move-page-cache-to-stack-middleware-40.diff28.98 KBznerol
#33 interdiff.txt1.77 KBznerol
#33 2348679-move-page-cache-to-stack-middleware-32.diff26.83 KBznerol
#31 ab-logs.tar_.gz1.26 KBznerol
#28 interdiff.txt3.6 KBznerol
#28 2348679-move-page-cache-to-stack-middleware-28.diff26.19 KBznerol
#25 interdiff.txt2.73 KBznerol
#25 2348679-move-page-cache-to-stack-middleware-24.diff26.19 KBznerol
#23 interdiff.txt784 bytesznerol
#23 2348679-move-page-cache-to-stack-middleware-23.diff25.92 KBznerol
#22 interdiff.txt4.2 KBznerol
#22 2348679-move-page-cache-to-stack-middleware-22.diff25.88 KBznerol
#21 interdiff.txt4.2 KBznerol
#20 2348679-move-page-cache-to-stack-middleware-20.diff23.74 KBznerol
#14 interdiff.txt3.6 KBznerol
#11 2348679-move-page-cache-to-stack-middleware-11.diff23.09 KBznerol
#6 2348679-move-page-cache-to-stack-middleware-6.diff22.18 KBznerol
#1 2348679-move-page-cache-to-stack-middleware.diff22.67 KBznerol
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

znerol’s picture

Status: Active » Needs review
FileSize
22.67 KB

This will fail due to the fact that session_name() is not initialized at the point where the NoSessionOpen request policy is instantiated. This is resolvable by #2347877: Move DrupalKernel::initializeCookieGlobals() into a SessionConfiguration service.

Status: Needs review » Needs work

The last submitted patch, 1: 2348679-move-page-cache-to-stack-middleware.diff, failed testing.

tim.plunkett’s picture

Title: Move the remaining procedural page cache code to the page cache stack middlewar » Move the remaining procedural page cache code to the page cache stack middleware

Middlewar sounds pretty cool :)

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 1: 2348679-move-page-cache-to-stack-middleware.diff, failed testing.

znerol’s picture

Status: Needs work » Needs review
FileSize
22.18 KB

Reroll.

Status: Needs review » Needs work

The last submitted patch, 6: 2348679-move-page-cache-to-stack-middleware-6.diff, failed testing.

Wim Leers’s picture

Berdir’s picture

Test fails look like there's an issue with serializing non-serializable responses, like files, among other things.

+++ b/core/lib/Drupal/Core/EventSubscriber/FinishResponseSubscriber.php
@@ -136,17 +136,6 @@ public function onRespond(FilterResponseEvent $event) {
-
-    // Currently it is not possible to cache some types of responses. Therefore
-    // exclude binary file responses (generated files, e.g. images with image
-    // styles) and streamed responses (files directly read from the disk).
-    // see: https://github.com/symfony/symfony/issues/9128#issuecomment-25088678
-    if ($is_cacheable && $this->config->get('cache.page.use_internal') && !($response instanceof BinaryFileResponse) && !($response instanceof StreamedResponse)) {
-      // Store the response in the internal page cache.
-      drupal_page_set_cache($response, $request);
-      $response->headers->set('X-Drupal-Cache', 'MISS');
-      drupal_serve_page_from_cache($response, $request);
-    }

I assume we somehow lost this part?

Berdir’s picture

  1. +++ b/core/lib/Drupal/Core/StackMiddleware/PageCache.php
    @@ -24,32 +31,241 @@ class PageCache implements HttpKernelInterface {
    +  protected function lookup(Request $request, $catch) {
    +    $cache = $this->cache->get(drupal_page_cache_get_cid($request));
    +    if ($cache) {
    

    Can we move drupal_page_cache_get_cid() into this as well (it is not used anywhere else I think) or at least wrap it in a method that is easy to override?

    Goal: Solve #2062463: allow page cache cid to be alterable by making it easy to subclass this and replace the service.

  2. +++ b/core/lib/Drupal/Core/StackMiddleware/PageCache.php
    @@ -24,32 +31,241 @@ class PageCache implements HttpKernelInterface {
    +    $cid = drupal_page_cache_get_cid($request);
    +    $tags = explode(' ', $response->headers->get('X-Drupal-Cache-Tags'));
    +    $this->cache->set($cid, $response, $expire, $tags);
    

    Same here, move this part into a helper method, like writeInternalCache() would make it easier to explore some ideas I had with having a quickly expiring edge cache + a long-living page cache that uses cache tags for invalidation.

+++ b/core/lib/Drupal/Core/StackMiddleware/PageCache.php
@@ -24,32 +31,241 @@ class PageCache implements HttpKernelInterface {
+    // Currently it is not possible to cache some types of responses. Therefore
+    // exclude binary file responses (generated files, e.g. images with image
+    // styles) and streamed responses (files directly read from the disk).
+    // see: https://github.com/symfony/symfony/issues/9128#issuecomment-25088678
+    if ($response instanceof BinaryFileResponse || $response instanceof StreamedResponse) {
+      return $response;
+    }

Extending on #9, I think we are missing the use for those two interfaces?

znerol’s picture

Status: Needs work » Needs review
FileSize
23.09 KB

Can we move drupal_page_cache_get_cid() into this as well (it is not used anywhere else I think) or at least wrap it in a method that is easy to override?

Agree, done.

Extending on #9, I think we are missing the use for those two interfaces?

Right, fixed.

Same here, move this part into a helper method, like writeInternalCache() would make it easier to explore some ideas I had with having a quickly expiring edge cache + a long-living page cache that uses cache tags for invalidation.

What about extracting a storage class instead?

Wim Leers’s picture

Can we get an interdiff? :)

Status: Needs review » Needs work

The last submitted patch, 11: 2348679-move-page-cache-to-stack-middleware-11.diff, failed testing.

znerol’s picture

FileSize
3.6 KB

Oh, sorry. Forgot to attach.

Wim Leers’s picture

Issue tags: +needs profiling
+++ b/core/lib/Drupal/Core/StackMiddleware/PageCache.php
@@ -268,4 +271,22 @@ protected function fetch(Request $request, $catch = TRUE) {
+   *   The cache key for this request.
...
+  protected function getCacheKey(Request $request) {

This is a misnomer; we call the parts that make up a cache ID "cache keys", but this returns the "cache ID", not "cache keys".

I bet it's the fact that this can easily be looked at as a key/value store type thing that made you think of this name, that'd make perfect sense in that context? :)


Other than that, this patch looks awesome! I think we want some profiling here to ensure we don't make things slower? But IIRC that already happened somewhere else, before #2257695: [meta] Modernize the page cache got split up into many child issues? Since so much time has passed, we probably want to do new profiling anyway though?

dawehner’s picture

It would be pretty slick if we could stop including the page cache middleware, if its not configured to be executed.

Berdir’s picture

Possibly, but that would require a container rebuild when you change the setting.

That said, *if* we would that, we could drop the settings check there *and* the weird setting, because we would always check if enabled, so that might be quite interesting for performance. So maybe a follow-up to investigate that?

Wim Leers’s picture

Wow, that sounds fascinating!

dawehner++
Berdir++

znerol’s picture

Status: Needs work » Needs review
FileSize
23.74 KB

Took me some time to fix the remaining test fails... Will address the pending feedback (thanks!) in a subsequent patch.

znerol’s picture

FileSize
4.2 KB
znerol’s picture

znerol’s picture

I actually meant to pass through $allow_invalid.

dawehner’s picture

Really great work!

@znerol
What do you think about the follow up to pass the configuration on compiler dump time?

  1. +++ b/core/lib/Drupal/Core/StackMiddleware/PageCache.php
    @@ -24,32 +32,273 @@ class PageCache implements HttpKernelInterface {
    +  protected function pass(Request $request, $type = self::MASTER_REQUEST, $catch = TRUE) {
    +    return $this->forward($request, $type, $catch);
    +  }
    

    Why do we not just call ->forward in places we call pass?

  2. +++ b/core/lib/Drupal/Core/StackMiddleware/PageCache.php
    @@ -24,32 +32,273 @@ class PageCache implements HttpKernelInterface {
    +      \Drupal::service('content_negotiation')->getContentType($request),
    

    Is there a reason we don't inject it atm. already?

znerol’s picture

Re #24:

  1. forward() is also called from within fetch(). Inlining pass() will result in a situation where a subclass would be incapable of telling the reason for a call to kernel handle().
  2. There is no reason I guess
dawehner’s picture

forward() is also called from within fetch(). Inlining pass() will result in a situation where a subclass would be incapable of telling the reason for a call to kernel handle().

Okay, that is fair!

One thing which changed now, is that we inject the configFactory, so even if you have set Settings::get('page_cache_without_database'
the db is initialialized, additional to all other dependencies of the config manager. Not sure whether we should deal with it, given the idea of #17/#18
which would solve that problem again.

Berdir’s picture

That's a very good point. Maybe we should not inject the config factory but add a @todo on a follow-up for the dynamic service definition idea? Definitely needs to be profiled.

znerol’s picture

Addresses #26, indeed very good point. Note that config is also accessed from within fetch(). Thus a follow-up in the spirit of #17 will likely need to convert the compression-setting into a container parameter.

Berdir’s picture

I think we have an open issue for that already somewhere, not quite sure, however.

Wim Leers’s picture

Leaving at NR; just nitpicks for the fix of #16 :)

  1. +++ b/core/lib/Drupal/Core/StackMiddleware/PageCache.php
    @@ -24,32 +32,332 @@ class PageCache implements HttpKernelInterface {
    +   * Gets the page cache id for this request.
    

    s/id/ID/

  2. +++ b/core/lib/Drupal/Core/StackMiddleware/PageCache.php
    @@ -24,32 +32,332 @@ class PageCache implements HttpKernelInterface {
    +   *   The cache key for this request.
    

    s/key/ID/

znerol’s picture

FileSize
1.26 KB

Attempting to perform some benchmarks without database access. Baseline is 8.0.x HEAD with the mockcache module enabled and properly configured, database server turned off, PHP 5.6.4 with Zend OPcache v7.0.4-dev.

$ ab -k -c1 -n1000 http://localhost:3000/ (see attachments for the full log):

HEAD

Requests per second:    170.27 [#/sec] (mean)
Time per request:       5.873 [ms] (mean)

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.0      0       0
Processing:     5    6   1.4      5      18
Waiting:        5    6   1.4      5      18
Total:          5    6   1.4      5      18

patch (db turned off)

Requests per second:    109.67 [#/sec] (mean)
Time per request:       9.118 [ms] (mean)

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.0      0       0
Processing:     3    9   2.4      8      24
Waiting:        0    9   2.5      8      24
Total:          3    9   2.4      8      24

Turns out that the early exit in HEAD sidesteps the call to $kernel->terminate() in the front controller. Since subscribers of the terminate event wish to access all kinds of stuff, the database connection is initiated there (and if the db is not available the request blows up in a weird way #2408435: Uncaught exception message is shown when exception is thrown during the terminate event).

patch (db accessible)

The results above are with the db turned off and exceptions thrown all over the place, they are worse when the db is accessible:

Requests per second:    80.03 [#/sec] (mean)
Time per request:       12.495 [ms] (mean)
Time per request:       12.495 [ms] (mean, across all concurrent requests)
Transfer rate:          23.06 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.0      0       0
Processing:    10   12   2.9     11      35
Waiting:       10   12   2.9     11      35
Total:         10   12   2.9     11      35

patch (terminate removed)

When simply removing $kernel->terminate() from the front controller, the results are as follows:

Requests per second:    163.53 [#/sec] (mean)
Time per request:       6.115 [ms] (mean)

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.0      0       0
Processing:     5    6   1.3      6      19
Waiting:        5    6   1.3      6      19
Total:          5    6   1.3      6      19

I think the tiny regression is acceptable given it is well within the margin of error (= standard deviation multiplied by 2).

Just how we can get rid of $kernel->terminate() for cached responses?

Wim Leers’s picture

I think the tiny regression is acceptable […]

Do we understand why there is a regression?

[…] given it is well within the margin of error (= standard deviation multiplied by 2).

That's fair, but if it's consistently reproducible to have a lower throughput, then that argument would be less applicable.

Also note that the standard deviation is lower than that of HEAD, which is good. Can we also consistently reproduce that lower standard deviation? If we can, that'd be another reason in favor of the patch.

znerol’s picture

Currently DrupalKernel checks whether the kernel has been booted before forwarding terminate to the http kernel. We simply could check whether preHandle() was run instead.

Berdir’s picture

+++ b/core/lib/Drupal/Core/DrupalKernel.php
@@ -529,7 +538,7 @@ public function getServiceProviders($origin) {
   public function terminate(Request $request, Response $response) {
-    if (FALSE === $this->booted) {
+    if (FALSE === $this->prepared) {
       return;

Can we add a comment here why we are doing this?

With that I think this is ready.

Will try to do something profiling on this as well.

Status: Needs review » Needs work

The last submitted patch, 33: 2348679-move-page-cache-to-stack-middleware-32.diff, failed testing.

dawehner’s picture

+1 for the wrapping of \Drupal::config() for now.

@znerol
I think one approach we could indeed do is to use config to fill the compression setting, or lets be honest, this is not really something you need to configure through the UI IMHO.

znerol’s picture

Re #32 found the reason: Now that everything moved to the middleware, the response policy is also instantiated when cached requests are delivered (~ +200 function calls).

znerol’s picture

Oh, and another fun thing: All middlewares are constructed as soon as the http kernel is instantiated. It follows that performance of the page cache depends on the dependencies of all middlewares - unless perhaps if those with heavy dependencies are constructed lazily.

znerol’s picture

Status: Needs work » Needs review
FileSize
28.98 KB
2.57 KB

I've reviewed usage of the needs_destruction tag. In core it is only used for CacheCollector and derivative classes (e.g. theme registry, alias whitelist) in order to update caches which accumulate entries over time. Therefore I think it is okay to simply fix the test here.

Also addressed #34.

Wim Leers’s picture

lets be honest, this is not really something you need to configure through the UI IMHO

+1

#37: awesome!

#38: I'd hope #1973618: DIC: Lazy instantiation of service dependencies (ProxyManager for "proxy services") helps with that? :)

neclimdul’s picture

re: #37, why was that not being called prior to this patch? Did we add the code using this service to improve performance characteristics in some way? I don't see a discussion of it in this thread.

Being as its sort of hard to pick them out, are there any other code changes that should be noted that aren't just moving code around that we could document in the summary?

znerol’s picture

why was that not being called prior to this patch?

I cannot follow, please elaborate.

are there any other code changes that should be noted that aren't just moving code around that we could document in the summary?

This patch does not contain any functional changes. Even the change to DrupalKernel regarding terminate() is just compensating for the early exit we had before.

The reason for the slight regression visible from #31 is that response policy is prematurely constructed as a result of injecting it. That being said, we could make the response policy lazy (as proposed by wim) after #2408357: The ProxyBuilder includes parent interfaces, which causes php errors. gets in. Benchmark looks like this then:

Requests per second:    169.00 [#/sec] (mean)
Time per request:       5.917 [ms] (mean)

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.0      0       0
Processing:     5    6   1.3      5      19
Waiting:        3    6   1.3      5      19
Total:          5    6   1.3      5      19

Head is 5.873 [ms] (see #31), margin of error is 2.6. Difference between HEAD and patch with lazy loaded response policy in terms of function calls is 26.

neclimdul’s picture

Yeah, I understood that injecting the service was causing this regression. I should have been more clear though. Injecting the services lead to the regression but if that code was being used previously it should have had similar characteristics that made me ask why we started injecting it. So I found the code calling this service which is just this one block of code.

+++ b/core/lib/Drupal/Core/StackMiddleware/PageCache.php
@@ -24,32 +32,332 @@ class PageCache implements HttpKernelInterface {
+    if ($this->responsePolicy->check($response, $request) === ResponsePolicyInterface::DENY) {
+      return $response;
+    }
+

This code did not exist previously so why was it added?

Also made me curious if there was any other code that was added to deal with the code being called differently or something.

znerol’s picture

This code did not exist previously so why was it added?

Oh, I see. That code still exists in FinishResponseSubscriber where this was extracted from. That's why it does not show up in the patch. The response policy is evaluated two times now, once for the internal cache in the middleware and once when setting headers for external caches. Note that this was already the case for the request policy before.

znerol’s picture

Priority: Normal » Major
Issue summary: View changes
Issue tags: +contrib dependency
znerol’s picture

Wim Leers’s picture

Wim Leers’s picture

Draft CR looks good.

Difference between HEAD and patch with lazy loaded response policy in terms of function calls is 26.

Do you see any way to reduce that increase, or even turn it around into a decrease?

znerol’s picture

Do you see any way to reduce that increase, or even turn it around into a decrease?

The increase is due to the fact that the class loader needs to find the response policy. Removing it from constructor arguments results in 6 function calls fewer than 8.0.x.

no response policy

=== baseline-8.0.x..2348679-move-page-cache-to-stack-middleware-no-response-policy compared (54bb92e2b52a0..54bb937d99d7d):

ct  : 2,198|2,192|-6|-0.3%
wt  : 6,504|6,304|-200|-3.1%
mu  : 1,589,528|1,587,688|-1,840|-0.1%
pmu : 1,590,880|1,591,112|232|0.0%

lazy response policy

=== baseline-8.0.x..2348679-move-page-cache-to-stack-middleware-lazy-response-policy compared (54bb92e2b52a0..54bb9543d2186):

ct  : 2,198|2,224|26|1.2%
wt  : 6,504|6,548|44|0.7%
mu  : 1,589,528|1,601,392|11,864|0.7%
pmu : 1,590,880|1,604,824|13,944|0.9%
znerol’s picture

Issue tags: +SprintWeekend2015
znerol’s picture

neclimdul’s picture

Re: my other questions. I see now how the combination of the request policy check in handle() and the response policy check roughly match the logic in FinalResponseSubscriber.

+++ b/core/lib/Drupal/Core/StackMiddleware/PageCache.php
@@ -24,32 +32,332 @@ class PageCache implements HttpKernelInterface {
+  /**
+   * Sidesteps the page cache and directly forwards a request to the backend.
+   *
+   * @param \Symfony\Component\HttpFoundation\Request $request
+   *   A request object.
+   * @param int $type
+   *   The type of the request (one of HttpKernelInterface::MASTER_REQUEST or
+   *   HttpKernelInterface::SUB_REQUEST)
+   * @param bool $catch
+   *   Whether to catch exceptions or not
+   *
+   * @returns \Symfony\Component\HttpFoundation\Response $response
+   *   A response object.
+   */
+  protected function pass(Request $request, $type = self::MASTER_REQUEST, $catch = TRUE) {
+    return $this->forward($request, $type, $catch);
+  }
+
...
+  /**
+   * Forwards a request to the http kernel.
+   *
+   * @param \Symfony\Component\HttpFoundation\Request $request
+   *   A request object.
+   * @param int $type
+   *   The type of the request (one of HttpKernelInterface::MASTER_REQUEST or
+   *   HttpKernelInterface::SUB_REQUEST)
+   * @param bool $catch
+   *   Whether to catch exceptions or not
+   *
+   * @returns \Symfony\Component\HttpFoundation\Response $response
+   *   A response object.
+   */
+  protected function forward(Request $request, $type = self::MASTER_REQUEST, $catch = TRUE) {
     return $this->httpKernel->handle($request, $type, $catch);
   }

Looking some more, can we merge these into a single method? They seem to do the same thing.

znerol’s picture

See #24ff.

neclimdul’s picture

There doesn't seem to be a distinction in the documentation. The interface is our contract and both essentially document "pass the request though to the backend" so I'm still not clear why we need two. At the very least we need to document why we need two methods and what makes each useful.

znerol’s picture

I failed to come up with sane documentation. Moreover, if two experienced core contributors stumble over the same lines it is very likely that something is not quite right there.

How about removing PageCache::forward() entirely and instead inline $this->httpKernel->handle()? I do not see any reason to override the forward() method in a subclass because the same effect can be achieved by simply adding another middleware between the page cache and the wrapped kernel.

Status: Needs review » Needs work

The last submitted patch, 55: 2348679-move-page-cache-to-stack-middleware-55.diff, failed testing.

znerol’s picture

Cannot reproduce the test-failure in UserAccountLinksTests.

znerol’s picture

Status: Needs work » Needs review
FileSize
28.67 KB

Reupload of #55.

neclimdul’s picture

That works for me. I don't see anything at this point that's a red flag and this is definitely where we where trying to go with the kernel. If Wim doesn't having anything else I'd support RTBC'ing this.

Hopefully we can start looking at tweaking logic to cut those calls out as follow ups too. Things like #1818628: Use Composer's optimized ClassLoader for Core/Component classes might minimize it at least.

PS - Thanks for putting up my the late questions and confusion! Great work!

neclimdul’s picture

+++ b/core/includes/bootstrap.inc
@@ -68,25 +68,18 @@
  * Fourth bootstrap phase: load code for subsystems and modules.

Dang-it I lied. We should fix this.

znerol’s picture

Right.

PS - Thanks for the review, much appreciated.

Wim Leers’s picture

Status: Needs review » Reviewed & tested by the community
FileSize
29.2 KB
1.83 KB

Repeatingn znerol's test methodology of #31 on my system, to see whether I can reproduce. With one major difference: I'm not using the MockCache module, so I'm testing actual responses, of the actual D8 frontpage. PHP 5.5.11, no XHProf, no XDebug, with OpCache, with DB. $ ab -k -c1 -n1000 http://tres/.

HEAD
Requests per second:    133.66 [#/sec] (mean)

              min  mean[+/-sd] median   max
Connect:        0    0   0.0      0       0
Processing:     6    7   0.6      7      11
Waiting:        5    7   0.6      7      10
Total:          6    7   0.6      8      11
patch
Requests per second:    132.05 [#/sec] (mean)

              min  mean[+/-sd] median   max
Connect:        0    0   0.1      0       0
Processing:     6    7   0.6      7      14
Waiting:        5    7   0.6      7      14
Total:          6    8   0.6      8      14

The difference is negligible: the min, mean, sd and median are identical when comparing HEAD with the patch; only in the max is there a significant difference, but since all other numbers are the same, that doesn't really have any noteworthy effect.

Therefore, together with #59: RTBC. Great work, znerol! :)


Found these nitpicks, and fixed them:

  1. +++ b/core/lib/Drupal/Core/DrupalKernel.php
    @@ -77,6 +77,13 @@ class DrupalKernel implements DrupalKernelInterface, TerminableInterface {
    +   * Whether essential services have been set up properly by preHandle.
    

    Nit: s/preHandle/preHandle()/

  2. +++ b/core/lib/Drupal/Core/StackMiddleware/PageCache.php
    @@ -24,32 +32,314 @@ class PageCache implements HttpKernelInterface {
       /**
        * Constructs a ReverseProxyMiddleware object.
        *
        * @param \Symfony\Component\HttpKernel\HttpKernelInterface $http_kernel
        *   The decorated kernel.
    -   * @param \Drupal\Core\DrupalKernelInterface $drupal_kernel
    -   *   The main Drupal kernel.
        */
    -  public function __construct(HttpKernelInterface $http_kernel, DrupalKernelInterface $drupal_kernel) {
    +  public function __construct(HttpKernelInterface $http_kernel, CacheBackendInterface $cache, RequestPolicyInterface $request_policy, ResponsePolicyInterface $response_policy, ContentNegotiation $content_negotiation) {
    

    These docs hadn't been updated accordingly.

alexpott’s picture

Status: Reviewed & tested by the community » Needs work
+++ b/core/lib/Drupal/Core/StackMiddleware/PageCache.php
@@ -24,32 +32,322 @@ class PageCache implements HttpKernelInterface {
+    $config = $this->config('system.performance');
+    if (extension_loaded('zlib') && !$response->headers->get('Content-Encoding') && $config->get('response.gzip')) {

Let's not do the config load if we don't have too. Yes we probably have already loaded system.performance - but we might not have so

    if (extension_loaded('zlib') && !$response->headers->get('Content-Encoding') && $this->config('system.performance')->get('response.gzip')) {
znerol’s picture

Status: Needs work » Needs review
FileSize
29.15 KB
850 bytes

Status: Needs review » Needs work

The last submitted patch, 64: 2348679-move-page-cache-to-stack-middleware-64.patch, failed testing.

znerol’s picture

Status: Needs work » Needs review
FileSize
29.17 KB
826 bytes

znerol--

Wim Leers’s picture

Status: Needs review » Reviewed & tested by the community

Oohh, well-spotted, Alex!

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed 1e985b0 and pushed to 8.0.x. Thanks!

Thanks for adding the beta evaluation.

  • alexpott committed 1e985b0 on 8.0.x
    Issue #2348679 by znerol, Wim Leers: Move the remaining procedural page...
Berdir’s picture

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.