Slow category menu, after upgrading from Nop 2.65 -> Nop 4.20

1 month ago
Hi All

We are in the middle of an upgrade from version 2.65 to 4.2 and the most is working out uf the box.
We have a lot og category menu items in the shop (more than 300.000) and even more products.

When the category menu is generated the first time, it calls the function: GetAllCategories
and GetAllCategories calls the stored procedure: CategoryLoadAllPaged
This gives us a timeout. I can see that a lot of the time is used on sorting.


Does anyone of you have the same requirements, for this amount of menu items? and how did you solve the performance challenge in version 4.2?

Any idea´s how to avoid using GetAllCategories?


Thank you in advance!! :-)
1 month ago
Taking 300000 items from database in one go is going to time out, it's not related on the method being used (whether it's Stored Procedure, vanilla SQL query or LINQ).

Did you mean it used to work in 2.65, and it didn't work now after upgrading to 4.20? I am more interested in knowing how do you achieve fast retrieval of 300k items in 2.65. I am also interested in knowing how do you show 300k categories in the menu?


1 month ago
It worked on the old version, in the front. And in the backend we mate some changes to make it work.

In the old version, there is a loop for each level, such child items is only loaded if the top parent item is clicked.
There was no topmenu for mobile back then, I guess thats why there was no need for all menuitems at the same time.

We are looking for a solution, where we only need to load the needed menu items, and not all 300K.

In the top level we only have 4 items.
1 month ago
Anyone?

My thought is to make a check, if the menu item exists in the selected part of the menu, or else skip the recursive call for building all categoryitems.
1 month ago
Instead of caching all category items at a time with a single cache key (NopModelCacheDefaults.CategoryAllModelKey), split them by their parent category ids.
1 month ago
Thanks Mhsjaber I will give it a try