Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug on category count (performance issue) #34109

Closed
Nuranto opened this issue Sep 17, 2021 · 18 comments · Fixed by mage-os/mageos-magento2#25
Closed

Bug on category count (performance issue) #34109

Nuranto opened this issue Sep 17, 2021 · 18 comments · Fixed by mage-os/mageos-magento2#25
Labels
Area: Framework Issue: needs update Additional information is require, waiting for response Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: done Reported on 2.4.x Indicates original Magento version for the Issue report. Triage: Dev.Experience Issue related to Developer Experience and needs help with Triage to Confirm or Reject it

Comments

@Nuranto
Copy link
Contributor

Nuranto commented Sep 17, 2021

In src/vendor/magento/module-catalog/Model/ResourceModel/Category/Collection.php

Line 330-333 :

                $productsCount = isset($categoriesProductsCount[$item->getId()])
                    ? (int)$categoryProductsCount[$item->getId()]
                    : $this->getProductsCountFromCategoryTable($item, $websiteId);

should be

                $productsCount = isset($categoryProductsCount[$item->getId()])
                    ? (int)$categoryProductsCount[$item->getId()]
                    : $this->getProductsCountFromCategoryTable($item, $websiteId);

( categoriesProductsCount instead of categoryProductsCount )

This is causing performance issue on backend category page especially when having a big amount of categories/products.

@m2-assistant
Copy link

m2-assistant bot commented Sep 17, 2021

Hi @Nuranto. 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


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

🕙 You can find the schedule on the Magento Community Calendar page.

📞 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.

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

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

@ihor-sviziev
Copy link
Contributor

Hi @Nuranto,
Could you create a PR with suggested changes and add a bit more info on how to reproduce it?

@Nuranto
Copy link
Contributor Author

Nuranto commented Sep 17, 2021

There is nothing to reproduce since it is just a performance issue.

Actually, I did more tests and it seems the table catalog_category_product_index is used for fetching pairs, but that table seems deprecated, so my first fix proposal doesn't fix performance issue by its own. It's quite difficult to make it work in default store it since there is no index for default store. But I will make a PR for this.

@m2-community-project m2-community-project bot added the Priority: P1 Once P0 defects have been fixed, a defect having this priority is the next candidate for fixing. label Oct 28, 2021
@engcom-November engcom-November added the Triage: Dev.Experience Issue related to Developer Experience and needs help with Triage to Confirm or Reject it label Mar 2, 2022
@engcom-Hotel engcom-Hotel self-assigned this Aug 29, 2022
@m2-assistant
Copy link

m2-assistant bot commented Aug 29, 2022

Hi @engcom-Hotel. 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: 👇

  • 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.

@engcom-Hotel
Copy link
Contributor

Hello @Nuranto,

Thanks for the report and collaboration!

We have verified the issue by looking into the codebase and we have found that the variable with the name $categoriesProductsCount is not defined anywhere in its scope. But we are using isset method on that, due to this it is not giving any error and simply calling $this->getProductsCountFromCategoryTable($item, $websiteId) method.

The correct variable name should be $categoryProductsCount instead of $categoriesProductsCount. Hence confirming the issue.

Thanks

@engcom-Hotel engcom-Hotel added Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Reported on 2.4.x Indicates original Magento version for the Issue report. Area: Framework labels Aug 29, 2022
@github-jira-sync-bot
Copy link

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

@m2-assistant
Copy link

m2-assistant bot commented Aug 29, 2022

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

@github-jira-sync-bot github-jira-sync-bot added Priority: P2 A defect with this priority could have functionality issues which are not to expectations. and removed Priority: P1 Once P0 defects have been fixed, a defect having this priority is the next candidate for fixing. labels Aug 30, 2022
@engcom-Bravo
Copy link
Contributor

Hi,

internal team started working on this issue.

Thanks.

@ihor-sviziev
Copy link
Contributor

ihor-sviziev commented Dec 18, 2023

@engcom-Bravo, would be great if they will just port mage-os/mageos-magento2#25 + mage-os/mageos-magento2#47, so it won't have 2 different implementation between the 2 forks

@engcom-Bravo
Copy link
Contributor

Hi @Nuranto,

We have checked this issue on magento 2.4-develop and As per the latest codebase and we have found that the variable $categoriesProductsCount name has been changed and the issue no longer reproducible. Hence we are closing this issue.Please find the attached screenshot for your references.

Screenshot 2023-12-14 at 6 40 09 PM

Thanks.

@m2-community-project m2-community-project bot added Progress: done and removed Progress: PR Created Indicates that Pull Request has been created to fix issue labels Jan 4, 2024
@ihor-sviziev
Copy link
Contributor

ihor-sviziev commented Jan 4, 2024

Hi @engcom-Bravo,
I double-checked - the change was merged in #35216.
The last comments states that it's not fixing the original issue #35216 (comment) #35216 (comment) #35216 (comment).

So the correct fix should be porting changes from mage-os/mageos-magento2#25 + mage-os/mageos-magento2#47.

I think we should re-open this issue

@Nuranto
Copy link
Contributor Author

Nuranto commented Jan 8, 2024

Hi @engcom-Bravo,

I agree with @ihor-sviziev's answer. The typo is fixed, but does not fix the real issue.

@ihor-sviziev ihor-sviziev reopened this Jan 8, 2024
@m2-community-project m2-community-project bot removed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Progress: done labels Jan 8, 2024
@engcom-Bravo
Copy link
Contributor

@ihor-sviziev Thanks for reopening the issue.

Hi @Nuranto,

Could you please update the description with the steps to reproduce and also Expected result and Actual result it will help us to proceed further.

Thanks.

@engcom-Bravo
Copy link
Contributor

Hi @Nuranto,

This issue is being closed since it has not been updated in a long time.Please feel free to reopen or raise a new ticket if the issue still exists.

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Framework Issue: needs update Additional information is require, waiting for response Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: done Reported on 2.4.x Indicates original Magento version for the Issue report. Triage: Dev.Experience Issue related to Developer Experience and needs help with Triage to Confirm or Reject it
Projects
Status: Ready for Development
7 participants