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
)
Comments
Comment #1
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:
Comment #6
bluegeek9 commentedDrupal 7 in End of Life and no longer supported. We encourage you to upgrade to a supported version of Drupal. For more information, see https://www.drupal.org/upgrade.