Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email

Magento Forum

Improving Magento Category Performance
Total Posts:  539
Joined:  2008-02-04

Hi all,

I am using Magento ver. 1.0.19700 (pretty outdated wink I know - But my store is live on this version). I started using the category functionality provided by Magento and on this version found this to consume a lot of Memory, processor time and page loads pathetically slow.

A small change - profiled the code and found that each category to diaply on the layered naviagtion repeatedly queries the entire category structure. For someone like me who has 4000 categories, this brings the system down.

So thought of caching the category structure (category is not something that changes regularly and any change we can refresh the cache). The below code helped me do that - replace the existing code for ‘getTreeModelInstance()” with

---------------- app\code\core\Mage\Catalog\Model\ Category.php ----------------
// Overrides default implementation to cache the category tree structure to improve category performance
public function getTreeModelInstance()
if (is_null($this->_treeModel)) {
if (is_null(Mage::registry(’category_tree’))) {
$this->_treeModel = $this->getTreeModel()->load();
} else {
$this->_treeModel = Mage::registry(’category_tree’);
return $this->_treeModel;
---------------- End ----------------

I am still looking at the pros and cons of this code before taking it to the production environment. I hear a lot of improvements have gone in after version 1.1for categories. I havent checked the latest code on the categories are handled and if it has the capacity to handle 4000 categories.

Weigh in with your thoughts on the same.

Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top