magento2 icon indicating copy to clipboard operation
magento2 copied to clipboard

[Performance] Slow product edit page with big amount of custom options

Open ihor-sviziev opened this issue 4 years ago • 22 comments

Preconditions (*)

  1. Magento 2.3.5-p2 or 2.4-develop

Steps to reproduce (*)

  1. Create simple product OR import following file: export_catalog_product_20200805_133448.zip
  • Add 8 custom options, each of them with option type "Drop-Down", values - 12 month names (Jan - Dec) image image
  • Save the product
  1. Open "Cusomizable options" section

Expected result (*)

  1. Browser should load custom options quite fast, 1-2 seconds.

Actual result (*)

  1. Browser becomes really crazy with high CPU load, it loads just this section for at least 5 seconds and whole page is quite slow during load.

Here is performance profile from Google Chrome extension: Profile-20200805T162549.zip

Use case

We would like to provide our customers an ability to customize amount and colors of stones on the product (up to 8 stones, in example each color named as month for simplicity of example).


Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.

  • [ ] Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • [ ] Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • [x] Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • [ ] Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • [ ] Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.

ihor-sviziev avatar Aug 05 '20 13:08 ihor-sviziev

Hi @ihor-sviziev. Thank you for your report. To help us process this issue please make sure that you provided the following information:

  • Summary of the issue
  • Information on your environment
  • Steps to reproduce
  • Expected and actual results

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

@magento give me 2.4-develop instance - upcoming 2.4.x release

For more details, please, review the Magento Contributor Assistant documentation.

Please, add a comment to assign the issue: @magento I am working on this


:warning: According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.

:clock10: You can find the schedule on the Magento Community Calendar page.

:telephone_receiver: The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, please join the Community Contributions Triage session to discuss the appropriate ticket.

:movie_camera: You can find the recording of the previous Community Contributions Triage on the Magento Youtube Channel

:pencil2: Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel

m2-assistant[bot] avatar Aug 05 '20 13:08 m2-assistant[bot]

Seems like following commit might also improve performance for the custom options: https://github.com/magento/magento2/commit/05fce8b29a33b047f7726e4b2a180811d44c7a6d @magento give me 2.4-develop instance

ihor-sviziev avatar Sep 04 '20 06:09 ihor-sviziev

Hi @ihor-sviziev. Thank you for your request. I'm working on Magento 2.4-develop instance for you

magento-engcom-team avatar Sep 04 '20 06:09 magento-engcom-team

Hi @ihor-sviziev, here is your Magento instance. Admin access: https://i-29409-2-4-develop.instances.magento-community.engineering/admin_43de Login: 46f2383a Password: 2877f23b4396 Instance will be terminated in up to 3 hours.

magento-engcom-team avatar Sep 04 '20 06:09 magento-engcom-team

Just checked - unfortunately it's not fixed the issue

ihor-sviziev avatar Sep 04 '20 06:09 ihor-sviziev

This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 14 days if no further activity occurs. Is this issue still relevant? If so, what is blocking it? Is there anything you can do to help move it forward? Thank you for your contributions!

stale[bot] avatar Jan 29 '21 00:01 stale[bot]

Still actual

ihor-sviziev avatar Jan 29 '21 04:01 ihor-sviziev

Hi @engcom-Delta. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

  • [ ] 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).

    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.

  • [ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • [ ] 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • [ ] 4. Verify that the issue is reproducible on 2.4-develop branch

    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

  • [ ] 5. Add label Issue: Confirmed once verification is complete.

  • [ ] 6. Make sure that automatic system confirms that report has been added to the backlog.

m2-assistant[bot] avatar Jan 29 '21 06:01 m2-assistant[bot]

:white_check_mark: Confirmed by @engcom-Delta Thank you for verifying the issue. Based on the provided information internal tickets MC-40673 were created

Issue Available: @engcom-Delta, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

magento-engcom-team avatar Jan 29 '21 08:01 magento-engcom-team

This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 14 days if no further activity occurs. Is this issue still relevant? If so, what is blocking it? Is there anything you can do to help move it forward? Thank you for your contributions!

stale[bot] avatar Apr 15 '21 13:04 stale[bot]

pls not close it

ihor-sviziev avatar Apr 15 '21 14:04 ihor-sviziev

Hello, is there an update on internal ticket MC-40673? I am looking for a solution too - experiencing performance issue in the admin panel for products with many checkbox / select custom options. Additional dependencies cause more slowness.

ksenia-zlotin avatar Apr 26 '21 13:04 ksenia-zlotin

This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 28 days if no further activity occurs. Is this issue still relevant? If so, what is blocking it? Is there anything you can do to help move it forward? Thank you for your contributions!

stale[bot] avatar Sep 25 '21 14:09 stale[bot]

Keep it open

ihor-sviziev avatar Sep 25 '21 21:09 ihor-sviziev

I have same problem. Magento backend is crazy slow. I also saw a very serious bug with customizable option price #34003 do you get the same @ihor-sviziev ?

onlinebizsoft avatar Oct 04 '21 14:10 onlinebizsoft

I would like to also state that we have this issue with large bundle products, essentially configurable servers. Any improvement to the performance would be appreciated.

Silarn avatar Jul 21 '22 23:07 Silarn

It it looks like it's a javascript loading error. The server itself (if looking at HTOP) does not get loaded. The problem is somewhere in the javascript listeners or something JS related.

The more options you add to Bundle Product for example, the longer the page takes to load.

This definitely needs improvement.

Also the Add Option listeners are not passive. Chrome complains:

"[Violation] Added non-passive event listener to a scroll-blocking 'touchstart' event. Consider marking event handler as 'passive' to make the page more responsive."

pmonosolo avatar Sep 01 '22 18:09 pmonosolo

@ihor-sviziev have you had any success fixing this issue?

pmonosolo avatar Sep 01 '22 18:09 pmonosolo

3 minutes to render a page:

image

image

image

It looks like dom-observer.min.js is taking up the whole time:

image

formChangesLists is the biggest issue: image image

image

During the whole time, the DB is not doing anything: image

pmonosolo avatar Sep 01 '22 18:09 pmonosolo

@pmonosolo, I don’t have any solution for this issue. But if you have it - please share

ihor-sviziev avatar Sep 01 '22 18:09 ihor-sviziev

@ihor-sviziev

Try this: https://github.com/magento/magento2/issues/34158 https://stackoverflow.com/questions/60357083/does-not-use-passive-listeners-to-improve-scrolling-performance-lighthouse-repo

Put this code at the end of jquery.js before the return: pub\static\adminhtml\Magento\backend\en_US\jquery.js

jQuery.event.special.touchstart = {
    setup: function( _, ns, handle ) {
        this.addEventListener("touchstart", handle, { passive: !ns.includes("noPreventDefault") });
    }
};
jQuery.event.special.touchmove = {
    setup: function( _, ns, handle ) {
        this.addEventListener("touchmove", handle, { passive: !ns.includes("noPreventDefault") });
    }
};
jQuery.event.special.wheel = {
    setup: function( _, ns, handle ){
        this.addEventListener("wheel", handle, { passive: true });
    }
};
jQuery.event.special.mousewheel = {
    setup: function( _, ns, handle ){
        this.addEventListener("mousewheel", handle, { passive: true });
    }
};

This seems to improve things.

UPDATE:

  • BLEH, retested it again and its still no bueno. On my local machine it had a bit of performance boost, but dev server no :(

pmonosolo avatar Sep 01 '22 20:09 pmonosolo

If someone is brave enough to dig in, I guess that a start would be to replace Array functions, especially in dom-observer.js

See https://leanylabs.com/blog/js-forEach-map-reduce-vs-for-for_of/

Nuranto avatar Sep 23 '22 19:09 Nuranto

Hello, i've same problem on my magento 2.4.4 my product have 1500 custom options and load time is 7sec. Do you have find a solution? Thanks a lot

mariogobos avatar Nov 18 '22 09:11 mariogobos

I have the same problem with the Bundle Product edit page. As @pmonosolo described, the more options and selections a Bundle has, the more time it takes to load the page.

As @Nuranto suggested, I replaced all the forEach Array functions with for...of in the dom-observer.js. E.g.

nodes.forEach(function (node) {
    result.push(node);

    children = extractChildren(node);
    result = result.concat(children);
});

becomes

for (const node of nodes) {
    result.push(node);

    children = extractChildren(node);
    result = result.concat(children);
}

But what really does the trick for me, was to get rid of all the concat calls in the dom-observer.js. E.g. in the above example

result = result.concat(children);

becomes

result.push(...children);

With these simple changes I was able to decrease the page load time for one of my Bundle Products from about 1min 20sec to 35sec.

I'd be interested to know if these changes also improve page load time for products with custom options (I don't have any of those).

densen45 avatar May 08 '23 14:05 densen45

@densen45, could you please create a Pull Request with your changes? So that we can run automated tests on top of them

ihor-sviziev avatar May 08 '23 15:05 ihor-sviziev

@magento I am working on this

densen45 avatar May 09 '23 05:05 densen45

:white_check_mark: Jira issue https://jira.corp.adobe.com/browse/AC-9127 is successfully created for this GitHub issue.

github-jira-sync-bot avatar Jul 11 '23 10:07 github-jira-sync-bot

:white_check_mark: Confirmed by @engcom-Lima. Thank you for verifying the issue.
Issue Available: @engcom-Lima, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

m2-assistant[bot] avatar Jul 11 '23 10:07 m2-assistant[bot]