3

We're currently working on a rather complex Drupal 8 based website. After clearing caches, the majority of pages/routes require about 30-60 seconds for being rendered/returning the desired results. Leveraging Drupal 8's dynamic page cache, this figure goes down to 250-700ms on subsequent requests.

Therefore, we implemented sitemap-based cache warming strategies (requesting all sitemap URLs through a NPM script after Drupal updates have been applied, configuration was imported, and caches cleared) for publicly accessible pages into our CI flow.

Now, I'm seeking to improve this solution. We want to additionally warm up the dynamic page caches for pages, that are available to authenticated users only. This comprises a lot of pages and custom entities with individualized content for various user groups and users, as well as a fine-grained permission scheme to selectively add/hide information per user.

Once again, when hitting these pages with cleared caches, they require loads of processing time until the first content is delivered to the browser. Subsequent hits for the very same user/route are fast enough for a decent (back-end) user experience.

There are about 2k different users and more than 400 user groups. Warming up all caches for all available user contexts would take about a day (given sequential warming and considering the current deployment times).

So I started wondering, whether I'm missing something, that could help warming up (as many as possible) dynamic page caches for authenticated users.

Is there any practice/strategy, that can be pointed out by the pro's in this group?

  • Why can't the authenticated warming be done the same? Just ensure to login first. Start a session, drush uli, login as authenticated page warmer, and run your request routine as described above. I'd say. Maybe even the Behat drupalextension can provide some of the logic. Maybe Xvfb or Selenium can be helpful, too. – leymannx Feb 3 at 12:33
  • I wouldn't consider your question to be too broad, but leading to primarily opinion-based answers instead. Although super-interesting at the same time! Maybe ask it over on reddit as well. – leymannx Feb 3 at 12:38
  • 30-60 seconds for being rendered/returning the desired results Why so slow? I presume you already looked into checking that all queries are optimized. Perhaps you're on a budget server that can't handle the traffic? Where is the server location? Have you considered using a CDN to serve at least the images? – No Sssweat Feb 3 at 12:59
  • It's a decent dedicated in-house server running this (intranet) application. Applying a whole lot of performance tuning and optimization, we managed to get the time to content down from an average of about 90 seconds. But given the complex pages, 30-60 seems to be the best we can get out of this machine without warm caches. – Mario Steinitz Feb 3 at 13:14
  • @leymannx, I edited the question to reflect that it's not just about authenticated/not authenticated, but also various groups, roles and permissions that makes cache warming a real challenge here. – Mario Steinitz Feb 3 at 13:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.