Performance on showing products in category

  • Posts: 62
  • Thank you received: 3
9 years 8 months ago #226093

-- HikaShop version -- : 2.6.0

I have a performance issue with displaying products in specific category.
And I notice a major difference in showing them in backend (fast) and frontend (timeout).

Now the server I'm running this on right now, will not be the one that will be running production, so I still have the choice of CPU / Memory power to choose from, but as I see this major difference, I'm wondering if there is something I can tune to have the items show faster in the front end as well.

In Backend, I use product page, select the proper category and shortly after that I get the list of products.
When I do the same through the frontend I get a timeout and notice mysqld at 100% CPU for still some time after receiving the timeout.

What could be the major factor for the difference, and can I tune that ?

NOTE: I only added apprx 3% of the category-product relations already resulting in 27000 rows in jos_hikashop_product_category table.
EDIT: NOTE2: I added the relationships directly into the database. So ordering field is '0' for all those products

Last edit: 9 years 8 months ago by storeitonline.

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

  • Posts: 62
  • Thank you received: 3
9 years 8 months ago #226127

Addition to the above.......

Increased php max_execution_time to 300. Page loads in around 65 seconds.....

I also noticed issues in the backend.
See attachements
In CategoryView you can see there is are categories for Aprilia - 1000 - 2009
In ProductView you can see the result after clicking the '+' for the 2009 category... no sub-categories displayed.

This issue does not arise for all categories thow :S
Rebuilding categories does not help (used that button numerous times already)

Attachments:

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

  • Posts: 62
  • Thank you received: 3
9 years 8 months ago #226160

Another addition to the performance issue......
If a category is empty, the page shows almost instantly. I assume that it still queries the hikashop_category_product table. So the delay is most likely caused on another level.....
However I added some more info into the table and load times increase to 160 sec. which is way too slow......

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

  • Posts: 4820
  • Thank you received: 654
  • MODERATOR
9 years 8 months ago #226172

Hello,

I had a look to your webpage example, and from my side I don't see performance issue, the categories listing page is displaying quite rapidly.
Plus, for the back-end issue, I need to see this by myself, so I invite you to send us a back-end access via our "Contact Us" form.
Don't forget, to put in the message subject of the contact us form, THIS topic subject.

Regards,

Last edit: 9 years 8 months ago by Philip.

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

  • Posts: 84328
  • Thank you received: 13718
  • MODERATOR
9 years 8 months ago #226197

Hi,

The best in that case is to turn on the "debug mode" of the Joomla configuration page and look at the debug data at the bottom of the page. You'll get the time it takes for each MySQL query and that way you can see which one takes time.
Then, it's possible to think of what can be done to make it faster (like removing some conditions, adding an index, etc).
I've tried to do that on your website but I got this:
take.ms/ahbfh
Apparently, the server crashed before sending the content of the page to the browser.
Could you try on your end and maybe increase temporarily some of the memory/execution time limits so that the result can be displayed on the page ?

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

  • Posts: 62
  • Thank you received: 3
9 years 8 months ago #226270

I moved my shop to another (faster) server, as we were interfering with some other website... (whoops).
Moved it to the new and desired (dedicated) server for the shop and new url : www.1stopmotoronderdelen.nl
You logons are the same on there.
As performance already increased dramatically on the new server I added some more data to the category-product relations. Still not all data is added, but page load already at 18 sec

(The backend issue still exists)

(I'm going to figure out why my pictures on products and subcategories are not showing in the new situation :( )

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

  • Posts: 62
  • Thank you received: 3
9 years 8 months ago #226308

Quickly checked the query times myself.
The query taking the longest is also executed multiple times. (Without knowing the code, it is executed for each product that is being shown).

SELECT hk_parent.*
FROM jos_hikashop_category AS hk_cat
LEFT JOIN jos_hikashop_category AS hk_parent
ON (hk_parent.category_left <= hk_cat.category_left
AND hk_parent.category_right >= hk_cat.category_right)
WHERE hk_cat.category_id IN ( ... list of categories ...)
GROUP BY hk_parent.category_id
ORDER BY hk_parent.category_left

And, with the amount of categories I'm using, this takes a very long time. Wondering why it is querying this, so perhaps I can turn off some.

Also not sure if my other topic also had its influence on these page load times. The current page load times appear to be much quicker since I changed the 'Best Rated' module (see topic TOPIC: Donot show 'best rated' products on product page)

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

  • Posts: 84328
  • Thank you received: 13718
  • MODERATOR
9 years 8 months ago #226339

Hi,

The system has to do a lot of queries to check what can be done and how and if the user has the right to do it, etc.
For example, this query is loading the parents of the categories of the current element.
It's done for example to check the "categories" restriction of badges, the categories restriction of filters, or to set the breadcrumbs on the product page.
The system has to do it for each element as the query can potentially have different ids.
So the more you disable things, and the less it has to do.

I've checked your new website URL but the pages are actually quite fast.
What page is slow for you there ?

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

  • Posts: 62
  • Thank you received: 3
9 years 8 months ago #226359

Thanks for looking into it with me.....
Performance did increase a lot on the new server, and after my other issue worked around.
But note that currently there is only 1 person looking at the site. (Perhaps 2 at once).
Look e.g. at www.1stopmotoronderdelen.nl/index.php/mo...v-transalp-pd06-pd10 22s. database queries.
(Not sure what is expected as acceptable from your end)

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

  • Posts: 62
  • Thank you received: 3
9 years 8 months ago #226421

I think I found out what is causing load times to be high. Now figuring out how I could decrease that.
SITUATION:
I have a lot of categories, and products are part of 1 or more categories. I found out that one of the products was part of almost all the categories. (Generic product). I removed that product from all specific categories, and load time of the category/product page increased.
So the biggest delay is caused by querying the hikashop_product_category. Now it appears, when looking at the query, it does query for stuff that is related to the other categories a product is part of. Why ? I can't see why it should do that, so can't figure out what to turn off to increase load times even more....

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

  • Posts: 26276
  • Thank you received: 4046
  • MODERATOR
9 years 8 months ago #226560

Hi,

Please provide details about your category/product listing configuration.

More you have data to process ; more time it will require.
Depending what you're trying to extract from the database, with a "wrong" configuration you can find in a lot of (sub)categories (like a listing which display "all sub elements").
And if your products are in a lot of categories, the table "product_category" will contain a big number of entries ; which will slower the SQL queries.

In that case, increasing the CPU and the memory of your server could be useful ; so the database will be stored entirely in the server memory (make queries faster) and the CPU will be more efficient.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

  • Posts: 62
  • Thank you received: 3
9 years 8 months ago #226562

Just another update.
Some database tuning also helped with my queries.... still not exactly to my likings. (Plans are to grow the number of products by approximately 10fold... or more... in the next year or 2, so better worry about the performance now ;) ).

Obviously the more data, the longer it will take.
Current server is 8 core & 16 GB Memory.

However, I'm still figuring out why the mentioned query is run, as I can't see any use for the results of the query... (yet)....
Obviously, i only have "all direct sub elements" shown in the final category. So the final category will show all products. But the query that is the slowest, does not show me any info required for that final page (or at least I don't see the requirement yet, so can't see why it is run, or what I could turn of to avoid it running)

I have provided login data ealier this week, so you could logon and take a look. (Debugging is turned off again at this point)

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

  • Posts: 26276
  • Thank you received: 4046
  • MODERATOR
9 years 8 months ago #226659

Hi,

Okay, you already have a good server.

Tuning the database is important if you want to handle big range of data.
HikaShop use some indexes for his tables.
For example, the "product_category" table use index on the product_id and it also have the primary key on the couple "category_id + product_id".
Using too much index does not help for the optimization, that's why we mostly focus on the most used queries.

When you're using the Joomla debug mode, you slow down the page generation ; but you can also see details on queries and see some reports.

Currently, you have few products (less than 200) but you have almost 6000 categories.
I don't know how many "product_category" you have but I think that the tweak should be focus on the categories.
Most websites have more products than categories ; that's why the HikaShop optimization are more oriented in that way.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

  • Posts: 62
  • Thank you received: 3
9 years 8 months ago #226713

Correction... 12.000 products !!! Not 200..
And the number of products will grow soon with large numbers when adding more suppliers. (Estimate to have about 50.000 products by the end of the year)
If you look at the site, you can see the requirement for the huge number of categories (about 2600 categories that have products, and a lot more in order to navigate to those individual categories, as there is no way I could filter on category custom fields.). And each category holds some number of products ranging from 1 to 60 at this point.

I know at the moment that perfmance is fairly good and definately acceptable, but I'm already looking forward.

To bring it down to the basic question I have:
When opening a category page that has products assigned to it, why does it run the "SELECT hk_parent.*" query for each product trying to get ALL other categories a product is part of. That information is (for what I can see and understand now) not required to display the page. Because when looking at the debug information, that is the query that is run multiple times and takes the most of time, depending on the number of categories a product is part of.

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

  • Posts: 13201
  • Thank you received: 2322
9 years 7 months ago #231343

Hi,

This request is used for the Breadcrumb.
It allow to get all the parent categories and fill the breadcrumb correctly.

If you don't use breadcrumb or you use the simplified one, you can potentially edit the file "components/com_hikashop/views/product/view.html.php"

And in the "'listing()" function replace the code:

				$categoryClass = hikashop_get('class.category');
				$pathway = $app->getPathway();
				$category_pathway = '&'.$pathway_sef_name.'='.JRequest::getVar('menu_main_category');
				$categories = $categoryClass->getParents(reset($pageInfo->filter->cid));
				$one = true;
				if(!empty($categories)){
					foreach($categories as $category){
						if($one){
							$one = false;
						}else{
							$categoryClass->addAlias($category);
							$pathway->addItem($category->category_name,hikashop_completeLink('category&task=listing&cid='.(int)$category->category_id.'&name='.$category->alias));
						}
					}
				}
By:
$category_pathway = '';

And in the "listing()" function of the file "components/com_hikashop/views/category/view.html.php" you can comment the code:
			$one = true;
			if(is_array($categories)){
				foreach($categories as $category){
					if($one){
						$one = false;
					}
					else{
						$class->addAlias($category);
						$alias = $category->alias;
						$pathway->addItem($category->category_name,hikashop_completeLink('category&task=listing&cid='.(int)$category->category_id.'&name='.$alias.$menu_id));
					}
				}
			}

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

  • Posts: 62
  • Thank you received: 3
9 years 6 months ago #232020

Thnx, I will look into this once I find the time......

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

Time to create page: 0.093 seconds
Powered by Kunena Forum