magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.47k stars 9.28k forks source link

Slow category loading due to configurable product swatches #39073

Open ioweb-gr opened 3 weeks ago

ioweb-gr commented 3 weeks ago

Preconditions and environment

Steps to reproduce

Create a website with many configurable products (we have around 4m total products including variations) and each one should have at around 250 variations. Finally load a category with 30 products while the cache is not fresh.

The page will take too long to load > 20s

Initially on Magento 2.4.6 we realized it was the swatches display which we disabled afterwards.

However when we upgraded the problem became apparent once again due to the swatches being loaded even if disabled in the backend.

Expected result

Page loads fast

Actual result

By profiling with blackfire we noticed that the system spends a lot of time in loading option prices

image

Resulting in 5 seconds of queries extra in the load apart from cpu processing.

By checking the renderer.phtml template we notice it's loading swatches configuration even if they're not enabled in the backend configuration option.

Additional information

There are two issues to solve here

  1. Performance with swatches enabled
  2. Disable loading the swatches in the category if the configuration option is not enabled in the backend

Release note

No response

Triage and priority

m2-assistant[bot] commented 3 weeks ago

Hi @ioweb-gr. Thank you for your report. To speed up processing of this issue, make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue: