The Twig cache key (twig_cache_prefix) is based the modify timestamp of the Twig template file and a randomly generated key. This gives a problem with a load-balanced Drupal setup where every host has it own copy of the Drupal source files, with different timestamps for the same template files across the hosts.

In this setup each Drupal instance keep generating a new prefix for every other request (when the balancer is in round-robin mode).

Is there a workaround for this?

  • You'd probably need to setup some sort of file replication between the servers wouldnt you? Especially for your sites/default/files folder so any user uploaded content is replicated
    – Leigh
    Nov 6, 2017 at 16:52

1 Answer 1


We host a platform in Acquia and we've run into this issue as well. For our needs, we get around it by logging into each webhead and clearing the appropriate cache.

There is an ongoing discussion for this in Drupal issue #2752961.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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