Change record status:
Published (View all published change records)
Introduced in branch: 8.6.x
Introduced in version: 8.6.0
Deploying Twig template changes in a multi webhead environment is not easy.
One strategy is sharing your file system and delete the twig files there (our current strategy). Sadly shared filesystems are slower.
The other strategy, not sharing files across servers, has the disadvantage, because deleting files would need need some form of sync between the servers. For more background information: #2752961: No reliable method exists for clearing the Twig cache.
As of #2752961: No reliable method exists for clearing the Twig cache we have a new method to invalidate Twig templates which is working across multiple webheads.
Before (not working on multiple webheads)
After (fully working)
In case your deployment actually executed something like
drupal_flush_all_caches() it will start to work also on multi webhead environments.
Note: the new approach invalidates files but doesn't delete files across multiple webheads. If you are running Drupal in a multi webhead environment, you might want to delete stale files from the storage manually. To read more about a potential solution read comments #102–#123 at #2752961-102: No reliable method exists for clearing the Twig cache, which contains a couple of suggestions for potential strategies.
In other words: newly deployed Twig templates will be picked up as expected across all webheads (as long as
\Drupal::service('twig')->invalidate(); is called after code deployment). But if each webhead is doing its own (local) caching, then stale compiled Twig templates will remain there. So over time, this could accumulate to a significant size.