Sydney August 2019: Caching in Drupal 8

Events happening in the community are now at Drupal community events on www.drupal.org.
murrayw's picture
Start: 
2019-08-15 18:00 - 21:00 Australia/Sydney
Organizers: 
Event type: 
User group meeting

The August 2019 meetup will feature a presentation by Jay Friendly on Caching in Drupal 8. Brian Gilbert, candidate for Director At Large of the DA, will make a short presentation with time for Q&A.

Location

Please see our Meetup page for the address details:
https://www.meetup.com/drupalsydney/events/czsmwpyzlbtb/

Attend remotely at 6.30pm:
https://meet.google.com/jcz-zrfj-rtk

Schedule

1800 Drinks
1830 Presentations
1915 Lightning talks and announcements
1930 Drinks, pizza, socialising and mentoring
2100 Close

Meet the candidate, Brian Gilbert

Brian is running for Director At Large for the upcoming Drupal Association board. He is the only Australian running. Brian will give a brief presentation on his candidacy and is open for questions from the floor.
https://www.drupal.org/association/blog/its-time-to-vote-community-elect...

Caching in Drupal 8, Jay Friendly

Jay will review the different caching layers inside Drupal, with a focus on cache tags and how to get them working nicely with reverse proxies and the like.

Lightning talks

Got a quick 5 min talk up your sleeve? Bring it along on the day.

Sponsors

Many thanks to our sponsors: Catalyst, PreviousNext, Morpht, Acquia, This Little Duck, Srijan.

Special shout out to our individual sponsors: Peter Cossey and Kiran Devarapalli.

Comments

Cache hell!

jannakha's picture

how very timely!
I was just fighting cache hell...
so here's my scenario:

  • D8 on Acquia with Varnish
  • Cron runs overnight to update some data
  • Custom code is NOT executed after cron updated
  • doesn't happen every time!

After clearing all caches possible (except for DB CACHE_* tables) nothing worked.
After digging around support articles:
- https://support.acquia.com/hc/en-us/articles/360005275013-How-Drupal-pag...
- and possibly this - https://www.drupal.org/node/1634506

I had to set Browser and proxy cache maximum age to NONE and then clear all the caches and clear Varnish.
And it worked!

So, I'm just curious why this happens, why only on prod env, how to reproduce consistently and how to fix?
It's definitely something to do with cron!

Anyone had similar issues?

Will try tune in on Thursday!
C ya!
J

Some tips

murrayw's picture

It sounds like the content has a max age set to a relatively large number and that Varnish is caching nodes for that period of time. In this case clearing cache tables etc in Drupal will not work because the cached asset is on the edge in Varnish.

You need to purge the updated assets from Varnish. As you are on Acquia, take a loo at Acquia Purge. This module will send a PURGE request to Varnish to remove the updated node from the cache. The next time an anon user comes to the site, the page will not be in Varnish and Varnish will ask Drupal for the new version.

The other option is to reduce the lifetime of the page down to a lower number, maybe an hour. That should still protect your site from spikes in traffic and the delay in updates may be considered OK by you.

This issue does crop up quite regularly with clients as they expect content to be updated immediately for anon users. Purging nodes will fix it, but you also need to consider listing pages which may have the node on it.

Jay's presentation will discuss cache tags and how they can be used to invalidate the cache for reverse proxies such as Varnish. In Drupal 8 we have finer grained control over the way pages can be invalidated.

Managing Director
Morpht

Australia

Group categories

Location

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: