0

Drupal 8.6.13 hosted on inmotion hosting VPS 2000

Website visitors/users are coming only from one country (Turkey) which is far away from the server location of inmotion hosting (USA).

In below explanation, please be aware I am speaking about my PRODUCTION site and not my DEVELOPMENT site.

My project get around 4000+ nodes per day and most users (not all) visiting those pages are anonymous users (80% anonymous users and 20% authenticated users)

The project mainly built upon those nodes which their contents change frequently... By other words, the website has less than 10 pages like "contact us" and "home" which will be updated around once per 3 months...

The general idea of the project:

There is one role (ROLE A) only responsible of creating those nodes for anonymous users and send the links for those node by email respectively for each user.

So in general, every anonymous user will have one node created for him by ROLE A and send the link of this node to the email address provided (in person) by this anonymous user.

The anonymous user then will click on the link received by email (Ex: domainname.com/jerwghfgd4534634hfghrt456gdger4) to access/view the node created for him.

The ROLE A will frequently update the content of those nodes in an unknown time:

  • after 60 seconds from the node creation time.
  • after 10 minutes from the node creation time.
  • after 38 minutes from the node creation time.
  • after 2 hours from the node creation time.

we can never know when the ROLE A will decide to update the contents of one or more node but the related email address of the anonymous user will get an email informing that your node has been updated.

PROBLEM:

When any anonymous user receive an email about some updates to the contents of his/her node, and he/she visit the url of the node to see those changes, he/she doesn't see any changes until I (as admin) flash all cashes on the site and purge caches from cpanel so those changes will take effect.

SO THE PROBLEM HERE IS MAINLY ABOUT CACHING...

SOLUTION (as per my understanding)

Since those node are frequently updated so no caching system should be enabled for them and also because the entire site is mainly (90%) based on those changes so I believe no caching system should be enabled for the entire site.

Thinking outloud, I believe I must:

  1. Disable for good the Internal Page Cache core module.
  2. Enable the Internal Dynamic Page Cache core module.
  3. in my cpanel -> cache manager, turn OFF the Enable caching which has the explanation (Enable or disable full page caching. This setting is useful if you are making lots of changes to your site, but it should not be disabled all the time.)
  4. Install the Cloudflare module (not sure if it is IMPORTANT to be installed)
  5. Point my site to a FREE cloudflare account with:

    _ Caching Level set to No query string

    _ Browser Cache Expiration set to Respect existing headers

    _ Always Online set to ON

    _ Development Mode set to OFF

Note:

I am using cloudflare because the server is far away from my visitors location and so the cloudflare will help to almost loose the latency available.

Hello experts... the BIG question:

does the explained above is what need to be done for the requirement of my website, or there is another workaround available ?

4

When you are working with CDNs and multiple layers of caches, it's very important to identify which caches is actually giving you problems.

Out of the Drupal handles clearing caches itself in Drupal 8. So when you update a node, the page cache and render cache and all kinds of cache is cleared for that node alone. This means that when an editor updates a node, you should not need to clear caches on your Drupal site for anonymous users to have them see the updated content. If this is not working, then you most likely have some custom code breaking this, as it's a core feature of Drupal 8.

Most likely your problem is solely the CDN / Cloudflare cache. If this cache is not purged when the Drupal cache is purged, then users will keep getting the stale cache until it expires.

The big question here is why use a CDN for this at all? CDN only becomes valuable if the same page is viewed many times, but from your explanation all nodes only have a single user viewing it. This means that CDN doesn't provide any benefit as the CDN does not speed up things on on a cold cache, only when the cache is warm. I don't see a use case where you will have a warm cache anyways.

My suggestion would be to kill the CDN, this should solve your issues given what I've already explained.

  • all nodes only have a single user BUT this anonymous user might access this page from different devices/browser... could this be a performance problem if CDN is off ? I am using CDN not only for cache purposes but to reduce latency and benefit from feature like "under attack", "always online", many more... What about disable the internal page cache it will give some benefits ? – Elie Masaad Mar 17 at 13:26

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.