-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Batch products together during catalog rule indexer calculation to improve performance #37889
Batch products together during catalog rule indexer calculation to improve performance #37889
Conversation
Hi @aligent-lturner. Thank you for your contribution! Add the comment under your pull request to deploy test or vanilla Magento instance:
❗ Automated tests can be triggered manually with an appropriate comment:
Allowed build names are:
You can find more information about the builds here For more details, review the Code Contributions documentation. |
There was a previous PR for this issue (#34785), but it has since been closed, and the changes are no longer visible. Based on the description and comments, it was handling a specific case where there are no active rules. This PR is a more general performance improvement, and should help regardless of how many rules are present/active. |
@magento run all tests |
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues. |
@magento run all tests |
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues. |
@magento run all tests |
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues. |
caa9f66
to
d7a2d0d
Compare
@magento run all tests |
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues. |
d7a2d0d
to
9ba77b1
Compare
@magento run all tests |
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues. |
9ba77b1
to
4e189d2
Compare
@magento run all tests |
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues. |
…prove performance
4e189d2
to
a6be322
Compare
@magento run all tests |
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues. |
…prove performance
…ndexer_performance
…xer_performance' into feature/catalogrule_product_indexer_performance # Conflicts: # app/code/Magento/CatalogRule/Test/Unit/Model/Indexer/ReindexRuleProductsPriceProcessorTest.php # app/code/Magento/CatalogRule/Test/Unit/Model/Indexer/ReindexRuleProductsPriceTest.php
@magento run all tests |
@magento run Functional Tests B2B, Functional Tests CE, Integration Tests |
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues. |
@magento run Functional Tests B2B, Functional Tests CE |
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues. |
@magento run Functional Tests B2B |
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues. |
In 2 consecutive build runs, it was found that the build failures were flaky. Please refer to the below screenshots: Functional Tests CE Functional Tests B2b Hence moving this PR in |
@magento run all tests |
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues. |
@magento run all tests |
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues. |
@magento run Functional Tests CE, Functional Tests B2B, Functional Tests EE, Integration Tests, WebAPI Tests |
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues. |
@magento run Functional Tests CE, Functional Tests B2B, Functional Tests EE |
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please message the #magento-devops slack channel if they don't show in a reasonable amount of time and a representative will look into any issues. |
Hey @aligent-lturner I've created patch from your changes and applied it for our M2 instance. There is almost no benefit in scope of catalog-rule reindex. We have 500k products and there is 1 686 929 records in catalog_rule_product. Catalog Rule Product index has been rebuilt successfully in 01:16:59 with this patch Have u tested your changes? Have u had better results? |
Hi @kamilmaliszewski I have not done extensive performance testing of various scenarios, but I cannot imagine there is any realistic scenario where performance is not improved, even if the improvement is small. |
Yeah @aligent-lturner. It helps, but profit is not a big. Unfortunately it is not solution for catalog-rule problem of Magento with big catalog and many customer groups. I was debugging this catalog-rule and it seems that for existing catalog-rule the biggest problem is method if I understand this logic correctly, then when the catalog-rule it empty it seems that simple solution like
should solve the problem. |
Yes, that would solve that particular issue, but would still result in very poor performance in many other similar situations. I'm not suggesting this PR is a panacea for all catalog price rule performance issues - only that it will improve performance in general. |
a01560a
into
magento:2.4-develop
Description (*)
Improves performance of the Catalog Rule scheduled indexer by batching products together.
Currently, products are processed one by one. In the case of a large number of product changes, this can take a long time to process, even if there are no catalog rules present, as there will need to be at least 2 * number of products database queries (so with 10k products to process, there are at least 20k queries being performed).
This PR introduces a new class,
ReindexRuleProductsPrice
to be used in place ofReindexRuleProductPrice
. Additionally,RuleProductsSelectBuilder
has been modified to handle multiple products instead of a single one.Fixed Issues (if relevant)
catalogrule_product
index even when no catalog rule exists #34784Manual testing scenarios (*)
indexer_update_all_views
cron job) with a large number of products in the backlog (performance test)Questions or comments
I introduced a new class, rather than modifying the existing
ReindexRuleProductPrice
class. I could have potentially added a new function there to handle the case with multiple products, but it would have been a little messy in terms of updating associated tests.Contribution checklist (*)