-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Move catalog search indexer outside stores loop #33227
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
Move catalog search indexer outside stores loop #33227
Conversation
Hi @jasperzeinstra. Thank you for your contribution
❗ Automated tests can be triggered manually with an appropriate comment:
You can find more information about the builds here ℹ️ Please run only needed test builds instead of all when developing. Please run all test builds before sending your PR for review. For more details, please, review the Magento Contributor Guide documentation. 🕙 You can find the schedule on the Magento Community Calendar page. 📞 The triage of Pull Requests 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 |
Thanks you for contribution! |
@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 re-request them if they don't show in a reasonable amount of time. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't do array_merge in a loop, usually it's causing performance issues.
app/code/Magento/Elasticsearch/Model/Indexer/Fulltext/Plugin/Category/Product/Action/Rows.php
Outdated
Show resolved
Hide resolved
app/code/Magento/Elasticsearch/Model/Indexer/Fulltext/Plugin/Category/Product/Action/Rows.php
Show resolved
Hide resolved
app/code/Magento/Elasticsearch/Model/Indexer/Fulltext/Plugin/Category/Product/Action/Rows.php
Show resolved
Hide resolved
@jasperzeinstra, will you be able to update this PR with suggested changes? |
@engcom-Alfa: I think the comparison should be done between this PR and the parent commit of this branch (being 32fda1c in this case). Not on the latest 2.4-develop, because there are already more changes done to 2.4-develop and maybe some of them also influence the performance of this indexer. Not saying that the results will be different, just saying that the comparison is not accurate in my opinion. |
@engcom-Alfa, could you check if you merged the 2.4-develop into the branch with changes from PR before testing? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As we discussed with @engcom-Alfa in Slack - he tested changes with merged in the recent 2.4-develop branch.
@jasperzeinstra, could you double-check why your changes reducing indexation speed, which is not expected?
From what I can tell the testing results still make no sense since the code that was changed is only triggered by the partial reindexing system and not by the full reindexing system. Also running So to properly test this, the performance of the cronjob Does this make sense? |
Thanks @hostep for the guidance. Moving this issue in Ready for testing again. |
Thanks for the inputs @hostep , Yes, I executed full indexing by referring one of the above comment. I will re-do it following your further instructions. |
Hi @jasperzeinstra , @ihor-sviziev, @hostep ❌ QA not Passed Again as per below execution steps as well. Manual Scenario Steps
✔️ Expected result After Fix
❌ Actual result After Fix
|
@engcom-Alfa, when you should see the bigger difference only in cases when you will edit the same product(s) multiple times. |
@magento create issue |
Hi @jasperzeinstra, thank you for your contribution! |
Description (*)
There's a plugin (catalogsearchFulltextProductAssignment / Magento\Elasticsearch\Model\Indexer\Fulltext\Plugin\Category\Product\Action\Rows) in the Magento Elastisearch module that hooks in on the Category Products indexer (Magento\Catalog\Model\Indexer\Category\Product\Action\Rows)
This plugin receives the category id's that are reindexed by the Category Products indexer. This plugin collects the assigned products from these categorie id's per store. And inside this loop it triggers a Catalog Search Fulltext reindex for these product id's.
The problem is that the indexer is executed within the stores loop. But the indexer itself already does a reindex for all stores.
We ran in to this issue with our setup that contains 12 stores. 1 category was passed in to the Category Products indexer. The plugin was executed after fetches all connected products for this category (1000+). These 1000 were reindexed in the 12 stores loop and indexed 12 times in each loop.
Manual testing scenarios (*)
Contribution checklist (*)
Resolved issues: