Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 301140

Reduce memory consumption of the functions using taxonomy loadTree (includes the taxonomy overview and forums)

$
0
0

Problem/Motivation

When a taxonomy vocabulary contains too much terms, it is absolutely impossible to reach some pages like taxonomy overview, even if their content is paginated, because of an huge memory usage. This is caused by the taxonomy_get_tree function for huge taxonomies, but for medium sized taxonomies, this is also caused by the fact that we never clean unused variables.

For information, with a 72000 terms taxonomy (what is not so many for big websites) :

$start = memory_get_usage(TRUE);
$tree = \Drupal::entityManager()->getStorage('taxonomy_term')->loadTree($vid); // 72000 terms
$used_memory = memory_get_usage(TRUE) - $start;
echo $used_memory; // ~ 242 MB

Proposed resolution

Just unset loadTree result when it is not needed anymore. This will not save the life of huge websites but this will definetely help medium ones to stay usables.

Remaining tasks

Post the patch

User interface changes

None

API changes

None

Beta phase evaluation

-->

Reference: https://www.drupal.org/core/beta-changes
Issue categoryBug because it can cause fatal errors on very common features
Issue priorityMajor because that's a bug
Prioritized changesThe main goal of this issue is performance. (By clearing that unused variables we can free up a lot of memory)
DisruptionNot disruptive for core, contributed and custom modules because the variables are cleared while neither the core or a hook uses them.

Viewing all articles
Browse latest Browse all 301140

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>