Keyword

K2 V2.7 Extremely slow when user is logged in

  • Carlos Martin
  • Carlos Martin's Avatar Topic Author
  • Offline
  • New Member
More
8 years 1 month ago #152664 by Carlos Martin
K2 V2.7 Extremely slow when user is logged in was created by Carlos Martin
Good morning!

We have a website which uses k2 as the main content component. We've done a template override so that our items show certain extrafields when in the category view ( tarjetasolidariaaldeas.com/compras/motor , for example).

However, the website is extremely slow. It takes more than 10 seconds to load a category view page if the user is logged in - if users are not logged in, it loads almost instantly.

After extensive testing, we found out that the long load times are caused by k2, specifically the loading of extrafields in the category view.

Problem is, we need our users to be registered. I'm considering switching away from k2 to another cck, but I don't really want to do so, as k2 has always been a very useful component for us.

Is there something we can do to improve load times?

Thanks!

Please Log in or Create an account to join the conversation.

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
8 years 1 month ago #152677 by Krikor Boghossian
Replied by Krikor Boghossian on topic K2 V2.7 Extremely slow when user is logged in
Hello Carlos,

When the user is logged in then there is no caching.
How are these extrafields generated?

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

  • Carlos Martin
  • Carlos Martin's Avatar Topic Author
  • Offline
  • New Member
More
8 years 1 month ago - 8 years 1 month ago #152680 by Carlos Martin
Replied by Carlos Martin on topic K2 V2.7 Extremely slow when user is logged in
Good morning!

We have no caching on the website, as it interfieres with some of our components. We're only using gzip compression, and css & javascript minification, plus image optimization and such. At the moment, we don't have a CDN configured.

We're using the following method in our category_item.php override:
$extrafields = array();
foreach($this->item->extra_fields as $item)
{    
	$extrafields[$item->id] = $item->value;
}

This is an example of the code we use in the category_items
<?php if ($extrafields[11]!=0 ){ ?>
		  <div class="tachado"><img src="images/cross.png"><?php echo $extrafields[11]."<span>€</span>"; ?></div>
<?php }
$icon = "";
$symbol ="";
$promo ="";
$cashback = "";
$final ="";
switch ($extrafields[14]) {
    case "Compra Directa":
		$symbol ="€";
        $icon = '<div class="col12"><i class="uk-icon-shopping-cart"></i></div>';
		break;
    case "Afiliacion Fija":
		$symbol ="€";
		$icon = '<div class="col12"><i class="uk-icon-envelope-o"></i></div>';
		break;
	case "Cupon Fijo":
		$symbol ="€";
        break;
	case "Cupon Variable":
		$symbol ="%";
        break;
	case "Afiliacion Variable":
		$symbol ="%";
        break;
	case "Tracker Directo":
		$symbol ="€";
        break;
	case "Tracker Variable":
		$symbol ="%";
        break;
}
if ($extrafields[6]!=0 && $symbol == "€"){$promo =$promo . $extrafields[6] . $symbol . '</span><br> Precio final';}
if ($extrafields[7]!=0 && $extrafields[6]==0){$promo =$promo .  $extrafields[7] . $symbol . '</span><br> Descuento';}
if ($extrafields[8]!=0){$cashback = '<div class="col2"><span>' . $extrafields[8] . $symbol . '</span><br> para Aldeas';}	
$final = '<div class="col1"><span>' . $promo . $icon . '</div>' . $cashback . '</div>';
echo $final;
?>
Last edit: 8 years 1 month ago by Carlos Martin. Reason: Clarification of cache use

Please Log in or Create an account to join the conversation.

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
8 years 1 month ago #152683 by Krikor Boghossian
Replied by Krikor Boghossian on topic K2 V2.7 Extremely slow when user is logged in
The code seems fine.
If you are not using any caching at all and the site is functioning differently when you are logged in, you need to examine what else (modules, scripts etc) is being loaded when you load in.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

  • Carlos Martin
  • Carlos Martin's Avatar Topic Author
  • Offline
  • New Member
More
8 years 1 month ago #152687 by Carlos Martin
Replied by Carlos Martin on topic K2 V2.7 Extremely slow when user is logged in
Yes, we've done so, using several tools.

Here's a screenshot of joomla's debug console in our testing site:

imgur.com/071W6RY

As you can see, the Application: afterRenderComponent com_k2 takes the longest time to load.

This occurs also in the live site, only that the loading time is much, much bigger.

Please Log in or Create an account to join the conversation.

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
8 years 1 month ago #152692 by Krikor Boghossian
Replied by Krikor Boghossian on topic K2 V2.7 Extremely slow when user is logged in
Are you using any 3rd party K2 extensions?

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

  • Carlos Martin
  • Carlos Martin's Avatar Topic Author
  • Offline
  • New Member
More
8 years 1 month ago #152695 by Carlos Martin
Replied by Carlos Martin on topic K2 V2.7 Extremely slow when user is logged in
Yes, we have JA k2 filter and styleware's k2 booster. Both are currently disabled, since we're not using the filter, and styleware's booster didn't change the loading time of k2.

Other extensions are simple image gallery pro - outdated, since we're hardly using galleries.

Please Log in or Create an account to join the conversation.

  • Carlos Martin
  • Carlos Martin's Avatar Topic Author
  • Offline
  • New Member
More
8 years 1 month ago #152698 by Carlos Martin
Replied by Carlos Martin on topic K2 V2.7 Extremely slow when user is logged in
One thing we've noticed is that we have a lot of duplicated queries, these two are the ones with the highest amount of duplicates:
SELECT id, gender, description, image, url, `
  group`, plugins 
  FROM lntzq_k2_users 
  WHERE userID=XXX

And
SELECT * 
  FROM lntzq_k2_extra_fields 
  WHERE `
  group` = 3 
  AND published=1 
  AND (id IN (6,14,7,8,9,10,11,13,15,22,23,24,25) OR `type` = 'header') 
  ORDER BY ordering ASC

I the extrafields one I can understand, but we're not using the k2 profile at all. Is there a way we can disable it so it stops sending queries to the database?

Please Log in or Create an account to join the conversation.

  • Carlos Martin
  • Carlos Martin's Avatar Topic Author
  • Offline
  • New Member
More
8 years 1 month ago #152702 by Carlos Martin
Replied by Carlos Martin on topic K2 V2.7 Extremely slow when user is logged in
We finally managed to solve the issue.

The slow loading time was being caused by k2's user plugin. I truncated the k2_users table, disabled the plugin, and commented the calls being made from components/com_k2/models/item.php to the k2_users table, and the loading speed dropped from 10+ seconds to nearly 2.

Please Log in or Create an account to join the conversation.

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
8 years 1 month ago #152704 by Krikor Boghossian
Replied by Krikor Boghossian on topic K2 V2.7 Extremely slow when user is logged in
The user plugin will sync Regular Joomla! users as K2 users.
If that is not an issue, and you can work with regular Joomla! users I don; see any problems if you backup your edits.

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum