nopCommerce icon indicating copy to clipboard operation
nopCommerce copied to clipboard

Slow loading when Categoryview has products that contain complex content

Open ngtrian opened this issue 3 years ago • 8 comments

nopCommerce version: 4.4+

Steps to reproduce the problem:

  1. Enable paste image in Tinymce Open file Nop.Web\Areas\Admin\Views\Shared\EditorTemplates\RichEditor.cshtml and delete paragraph paste@(enableFullPage ? " fullpage" : null)
  2. Create a new product with product name is "HPE ProLiant DL380 Gen10 Server", Full description content copied from https://h20195.www2.hpe.com/v2/gethtml.aspx?docname=a00008180enw Expand all and copy all in red

image

image

  1. Categories I chose Computer>Desktops
  2. Save product

RESULT

After enable miniprofiler, I go to the public store, then open link category Desktops, I refresh the web several times

  • On nopCommerce 4.4, the average speed is 9000ms
  • I do the same with nopCommerce 4.3, the average speed is 105ms

Also on nopCommerce 4.4, at Admin> Catalog> Product page, when I search for products in category Desktops, the results are loaded very slowly.

I tried over and over again, even just downloading the original on github then running nopCommerce on localhost, but the result is the same as above

Here are two results I got from miniprofiler:

Catalog_Category (9191.8 ms) - Profiling Results nopCommerce 4.4.pdf Catalog_Category (104.5 ms) - Profiling Results nopCommerce 4.3.pdf

ngtrian avatar May 04 '21 17:05 ngtrian

I’m guessing because the ‘ PrepareProductOverviewModelsAsync’ in ProductModelFactory pulls the full description as well as the short description?

untiedshoes avatar May 04 '21 19:05 untiedshoes

I see nop 4.3 also has a full description but web performance has changed on the new version.

During use, I found that many other pages also had performance affected by this.

ngtrian avatar May 05 '21 10:05 ngtrian

I see a line of code:

//little performance optimization: ensure that "FullDescription" is not returned
productModel.FullDescription = string.Empty;

Whether there is a temporary solution for this, I have no need to use full descripion on categoryview or homepage

ngtrian avatar May 07 '21 07:05 ngtrian

Comment out https://github.com/nopSolutions/nopCommerce/blob/a298e6a29fd0cc130257afdca8f44bd4752cfead/src/Presentation/Nop.Web/Factories/ProductModelFactory.cs#L1215 and test.

One of my clients doesn't use short or full descriptions, so we comment both of these out for them.

untiedshoes avatar May 07 '21 08:05 untiedshoes

Comment out https://github.com/nopSolutions/nopCommerce/blob/a298e6a29fd0cc130257afdca8f44bd4752cfead/src/Presentation/Nop.Web/Factories/ProductModelFactory.cs#L1215 and test.

One of my clients doesn't use short or full descriptions, so we comment both of these out for them.

This doesn't solve the problem

ngtrian avatar May 07 '21 10:05 ngtrian

I think the problem is related to Async https://github.com/dotnet/ef6/issues/88

ngtrian avatar May 07 '21 10:05 ngtrian

The performance seems to be slow in loading speed whenever there is an action that calls this product, such as: Search autocomplete, homepage product.

ngtrian avatar May 19 '21 01:05 ngtrian

I tried this on PostgreSQL and it works great

This problem only occurs with Sql Server. https://github.com/dotnet/SqlClient/issues/593

ngtrian avatar Jun 09 '21 08:06 ngtrian

Since the issue is in SqlClient we not able to fix it now. There is only one workaround: switching to non-async API for problematic methods, but we leave it for customizing, because it happens under quite specific conditions.

exileDev avatar Oct 06 '22 14:10 exileDev