Author Topic: Slow router in mod_virtuemart_category  (Read 255 times)

sandomatyas

  • Jr. Member
  • **
  • Posts: 127
Slow router in mod_virtuemart_category
« on: August 21, 2017, 10:59:08 am »
I checked a site which has 15 categories and ~170 subcategories. Lately it is super slow, it takes 8-12 seconds to load a simle page.
I checked the modules and the code and found that if I disable my category module it becomes much faster.
After that i checked a source line by line and found this line in the template:
$caturl = JRoute::_('index.php?option=com_virtuemart&view=category&virtuemart_category_id='.$child->virtuemart_category_id);
If I remove it or change it to $caturl = JRoute::_(''); the site is fast. When I put it back, the site is slow.
It was okay until I updated VM few weeks back. Now it's running the very latest "beta" 3.2.3.9624
I couldn't find the solution, any clue maybe, somebody? Maybe something changed around the router?

Milbo

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 9327
  • VM3.2 Cached and Optimized
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: Slow router in mod_virtuemart_category
« Reply #1 on: August 21, 2017, 12:52:13 pm »
I should fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

sandomatyas

  • Jr. Member
  • **
  • Posts: 127
Re: Slow router in mod_virtuemart_category
« Reply #2 on: August 21, 2017, 16:05:10 pm »
#9579 is fast, #9610 is slow
I moved back to 9579

Milbo

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 9327
  • VM3.2 Cached and Optimized
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: Slow router in mod_virtuemart_category
« Reply #3 on: August 21, 2017, 17:13:36 pm »
There is this function

Code: [Select]
<?php
public static function getLimitByCategory($catId$view 'virtuemart'){

static $c = array();

if(empty($c[$catId][$view])){
$catModel VmModel::getModel('category');
$cat $catModel->getCategory($catId);
//vmdebug('getLimitByCategory '.$cat->limit_list_initial);
if(!empty($cat->limit_list_initial)){
$initial $cat->limit_list_initial;
vmdebug('limit by category '.$view.' '.$catId.' '.$cat->limit_list_initial);
} else {
$initial VmConfig::get('llimit_init_FE'24);
}
$app JFactory::getApplication();
$c[$catId][$view] = $app->getUserStateFromRequest('com_virtuemart.'.$view.'.limit''limit',$initial'int');
}
self::$limit $c[$catId][$view];
return self::$limit;
}
?>



Please try the last version and replace the function by

Code: [Select]
<?php
public static function getLimitByCategory($catId$view 'virtuemart'){

self::$limit $c[$catId][$view];
return self::$limit;
}?>


Looks like that is slowing down the shop. When yes, I can add a config or so. It is just for the feature "different pagination size (limit) per category", which is imho a feature, which is quite rarely used. I thought it wouldnt be a big deal, because it should use anyway already cached categories. But yes on a frontpage, showing productsd of very different categories, it creates a problem.
I should fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Milbo

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 9327
  • VM3.2 Cached and Optimized
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: Slow router in mod_virtuemart_category
« Reply #4 on: August 21, 2017, 17:36:34 pm »
or maybe it is even better and easier to disable line 87.
I should fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

sandomatyas

  • Jr. Member
  • **
  • Posts: 127
Re: Slow router in mod_virtuemart_category
« Reply #5 on: August 22, 2017, 12:31:03 pm »
yep, that was the solution

Studio 42

  • Contributing Developer
  • Full Member
  • *
  • Posts: 2182
  • Joomla & Virtuemart addon developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 &amp; 3.0.x.y
Re: Slow router in mod_virtuemart_category
« Reply #6 on: August 22, 2017, 14:25:03 pm »
@Max : Why you don't get limit from category directly on load and compare with session ?
And you set self::$limit as global value, but you never know from what category id is set.

Milbo

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 9327
  • VM3.2 Cached and Optimized
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: Slow router in mod_virtuemart_category
« Reply #7 on: August 22, 2017, 20:28:38 pm »
yep, that was the solution

To disable line 87?, because that would be the best. I just wonder anyway if we need it.
I should fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

sandomatyas

  • Jr. Member
  • **
  • Posts: 127
Re: Slow router in mod_virtuemart_category
« Reply #8 on: August 22, 2017, 21:16:15 pm »
yep, that was the solution

To disable line 87?, because that would be the best. I just wonder anyway if we need it.

Yes.
Do you think "different pagination size (limit) per category"? I think I was who asked for it :) I have two customers who need this function

Studio 42

  • Contributing Developer
  • Full Member
  • *
  • Posts: 2182
  • Joomla & Virtuemart addon developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 &amp; 3.0.x.y
Re: Slow router in mod_virtuemart_category
« Reply #9 on: August 23, 2017, 00:14:21 am »
yep, that was the solution

To disable line 87?, because that would be the best. I just wonder anyway if we need it.

Yes.
Do you think "different pagination size (limit) per category"? I think I was who asked for it :) I have two customers who need this function
This have no sense to be get or set in the router else VM do not work same with or without (SEF)router