Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Domain conf module registers shutdown function that sets stored language_default variable on each Drupal shutdown.
This way, drupal has to drop variables cache in cache_bootstrap table and recreate it on next request, after which the cache also will be flushed.
Hence, Drupal not only loses 20% effectivity (see variable_initialize: NOTE: caching the variables improves performance by 20% when serving cached pages.), but also wastes time to recreate this unused cache.
Also, with high loads and when drupal is forced to recreate variables cache on each request InnoDB falls to deadlock state:
PDOException: SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction: DELETE FROM {semaphore}
WHERE (name = :db_condition_placeholder_0) AND (value = :db_condition_placeholder_1) ; Array
(
[:db_condition_placeholder_0] => variable_init
[:db_condition_placeholder_1] => 98291012950c63acdeaf731.88652064
)
Comment | File | Size | Author |
---|---|---|---|
#4 | domain-remove-js-alter-1865552-4.patch | 438 bytes | Berdir |
#1 | 1865552_domain_conf_variable_set_only_when_necessary.patch | 1.02 KB | Sergii |
Comments
Comment #1
Sergii CreditAttribution: Sergii commentedPatch supplied
Comment #2
agentrickardThis was a nasty problem to fix in the first place. See #1271810: Default language gets changed for the original background.
I understand what the patch is doing. However, doesn't this result in having stale variables in the cache?
This code should only run in specific cases. Not on every page. So the problem really seems to be hook_js_alter().
What happens if we simply remove that call?
Comment #3
agentrickardI thought about this some more. I don't think we have to worry about stale cache. The original fix is to ensure that the initial (cached) value is retained in {variable}.
So my question is: Can we solve the issue by removing hook_js_alter()?
Comment #3.0
agentrickardspelling
Comment #4
BerdirBlast from the past :)
This patch does what #3 suggests, by removing that alter hook. I didn't test yet if it causes any problems, doing that as a set of performance improvements on a site that I will give to the client for testing soon.
Comment #5
agentrickardWe may also need to check that the variable is in fact changing in this code: