I' have been testing the category module with a heavy number (>10000) of category and noticed some serious performance lag. I spent a lot of time debuging and finally concluded that one big bottleneck was due to the static cache mechanism used in the category.inc module :

for instance within the function category_get_tree() the static variable $children require a database query which return all category within the relevant container. This might be a long query (1 second) if you have a boatload of category within the same container. Indeed this is a static variable meaning that the query will be done only once during the script processing, which is a good but on the other hand this static variable is not persistent beetween user calls : this mean that each time a user will trigger a category view within the same container the same heavy computation of this static variable will be done, if you have hundreds of simultaneous users you get the picture.

One possible work around would be to cache the variable in the database beetween calls, another possibility would be to reduce the scope of the array to build only the usefull part of the tree for the request.

The same problem exists elsewhere in the code for instance with the function category_is_cat_or_cont() and the static variable $nodes

I browse the Taxonomy code and noticed that the problem was already there with a static variable browsing through all terms within a vocabulary.

Comments

marcoBauli’s picture

a patch has been submitted to try paving the way for better caching / performances in this issue here.

It seems it deals with the problems pointed out here as well as others, so maybe this can be considered a duplicate of that one?

bdragon’s picture

Status: Active » Closed (duplicate)

Marking as duplicate of
http://drupal.org/node/82554