magento2
magento2 copied to clipboard
[Performance] Slow product edit page with big amount of custom options
Preconditions (*)
- Magento 2.3.5-p2 or 2.4-develop
Steps to reproduce (*)
- 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)
- Save the product
- Open "Cusomizable options" section
Expected result (*)
- Browser should load custom options quite fast, 1-2 seconds.
Actual result (*)
- 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”.
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
- Join Magento Community Engineering Slack and ask your questions in #github channel.
: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
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
Hi @ihor-sviziev. Thank you for your request. I'm working on Magento 2.4-develop instance for you
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.
Just checked - unfortunately it's not fixed the issue
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!
Still actual
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).
Details
If the issue has a valid description, the labelIssue: Format is valid
will be added to the issue automatically. Please, edit issue description if needed, until labelIssue: 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
branchDetails
- Add the comment@magento give me 2.4-develop instance
to deploy test instance on Magento infrastructure.
- If the issue is reproducible on2.4-develop
branch, please, add the labelReproduced 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.
: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.
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!
pls not close it
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.
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!
Keep it open
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 ?
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.
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."
@ihor-sviziev have you had any success fixing this issue?
3 minutes to render a page:
It looks like dom-observer.min.js is taking up the whole time:
formChangesLists is the biggest issue:
During the whole time, the DB is not doing anything:
@pmonosolo, I don’t have any solution for this issue. But if you have it - please share
@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 :(
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/
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
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, could you please create a Pull Request with your changes? So that we can run automated tests on top of them
@magento I am working on this
:white_check_mark: Jira issue https://jira.corp.adobe.com/browse/AC-9127 is successfully created for this GitHub issue.
: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.