Substantial bottle neck in nopCommerce 3.0 catalog pages!

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
10 years ago
Hi Andrei,

We have seen a few posts on the forum regarding the slow performance of the category pages and we have had quite a few clients complain about this after an upgrade to nopCommerce 3.0.

We have traced the problem and believe it is quite a bottle neck.

The PrepareProductOverviewModels method call this method twice for every product which is added to the model:

Nop.Services.Directory.CurrencyService.ConvertFromPrimaryStoreCurrency and it calls

Nop.Services.Directory.CurrencyService.GetCurrencyById each time, with the same id but not caching the results. Every call the GetCurrencyById causes the execution of the costly EF method DetectChanges.

http://blog.oneunicorn.com/2012/03/10/secrets-of-detectchanges-part-1-what-does-detectchanges-do/


For a category page with 12 products showing at the same time the total execution time of the GetCurrencyById is roughly 4 secs and the more products the slower the performance.

This might not be the only bottleneck but we think it is quite a substantial one and we think that it needs to be fixed in the current release if this is possible?

I hope this is useful!
10 years ago
Good catch... hopefully a quickfix can be made for this...
10 years ago
Agree. It should be fixed in the near time. Thanks a lot!

BTW, how many times is "GetCurrencyById" method called in your test environment so it takes 4 seconds?
10 years ago
After testing it with 12 products on a page it's called about 30 times. I'm not sure that it could cause 4 second performance drop. Are you sure that you're experiencing this issue because of DetectChanges being called and not something else?

UPDATE: I've just added back caching of currency (and some other entities) but still don't see any performance changes
10 years ago
Please see changeset 7e68389ef0a7. Give it a try and let me know if you feel nopCommerce running faster (I personally don't). I still think that there's some other reason(s) for this slowdown
10 years ago
Yes with 12 products it is called 24 times.

And both DotTrace and the FireBug Net tab report the same roughly 4 secs delay. The profiler does show GetCurrencyById ->GetById -> Find -> DetectChanges method as the bottleneck.

Please note that we are seeing this delay when we filter products, we call PrepareProductOverviewModels for the returned 12 products:

// Prepare ProductsModel
                productsModel = new ProductsModel
                {
                    NopAjaxFiltersSettingsModel = _nopAjaxFiltersSettings.ToModel(),
                    Products = PrepareProductOverviewModels(productsResultData.ProductsPagedList),
                    ViewMode = viewMode
                };


while the code for the Category action does the same thing:

model.Products = PrepareProductOverviewModels(products).ToList();


both the ProductsPagedList and products are of type IPagedList<Product>.

Do let met know if we are missing something!

And thanks for the quick fix!
10 years ago
But 24 calls to DetectChages cannot take 4 seconds. In my case it takes less than 0.1 sec.

Otherwise it should take more than 4 seconds to open a category detail page. Is it true for you?

Have you had a chance to test the changeset? Did it really help?
10 years ago
Sorry for not being able to answer your question right away but we will do more investigation tomorrow and I will let you know.

There is something strange going on definitely because I don't think the category load time is affected in the same way. I don't think that the categories are loading in 4 secs. But will let you know.

Will test your changes too.
10 years ago
after upgrade from 2.8 to 3.0, performance is incredibly slow, almost unusable.  We have about 75 categories and roughly 550 products.  Using 7 Spikes Mega Menu for categories and manufacturers.  Not sure if this is related or not.  

I look forward to feedback on this thread as I am at a point where I may need to revert our production site.  Things seemed ok locally in my testing, so did not expect this once deployed.

Thanks.

Todd
10 years ago
thinton99 wrote:
Using 7 Spikes Mega Menu for categories and manufacturers

Could you please test your installation without this plugin enabled? Does it help?
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.