-
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
setup:upgrade is changing indexer mode to save
from schedule
slowing it down immensely
#33386
Comments
Hi @ioweb-gr. Thank you for your report.
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:
For more details, please, review the Magento Contributor Assistant documentation. Please, add a comment to assign the issue:
🕙 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 |
I'm not able to test this on the demo instance. |
Hi @engcom-November. Thank you for working on this issue.
|
Let me add more info here. I tracked down this post https://maxchadwick.xyz/blog/lessons-learned-during-a-recent-magento-2-deploy It seems that during operations which lock the tables, dropping the trigger or creating it has to actually wait for all database locks to disappear. Looking further into the process I noticed that in my case it was trying to build the catalog price replica tables for the indexes which were locking the tables like this
Causing a lot of queries to wait during setup:upgrade making the downtime extremely high. Unfortunately even if you build the files in a different server the setup:upgrade procedure has to run on the production. This should never ever happen and cause such unpredictable downtimes This is what the end result in mytop looks like in such cases |
I think I have same issue. Will track this behavior and see |
I've seen it happen in 3 installations on 3 different servers and now before setup:upgrade I make sure all indexers are green to avoid the issue. I will report back if this stops occuring like this but it would be great if it can be verified |
Just an update, while following this practice the downtimes have reduced significantly because the locks are staying for a smaller period. The issue still persists but is minified like this. Basically I can verify that if the indexers are running on scheduled mode, the issue can happen with setup:upgrade if they have items in the backlog |
Hi @engcom-Delta. Thank you for working on this issue.
|
Hi @ioweb-gr Thanks |
Hi, what do you mean it's working fine? Let's take it one step at a time. Did you verify that during setup upgrade triggers are dropped and recreated? |
Hi @ioweb-gr , |
I see. Here's how to guarantee that you'll see triggers are dropped and recreated. Step 1: Put all indexers in scheduled mode.
Step 3: Execute setup upgrade How does this guarantee you'll notice the issue? First of all when indexers change mode from save to schedule and vice versa, triggers are created and dropped in order for the indexers to function. By adding the above check, when setup:upgrade executes it's going to throw an exception because of a DB level constraint. At that point you'll know for sure, that the mode on the indexer was changed from scheduled to save and that the setup:upgrade command tried to drop / recreate the triggers. Could you give it a try? |
Hi @engcom-Hotel. Thank you for working on this issue.
|
Hello @ioweb-gr, We have tried to reproduce the issue in Magento 2.4-develop branch with the following data: But for us the video.mp4Thanks |
Hi, that only means that you cannot simulate real conditions this way. On our client's store we have around 60k products, 500 orders daily, 50-150 concurrent customers browsing the website at all times, 5 people doing data entry, multiple catalog price rules, 5 sources, 11 stocks etc etc. The indexers are constantly having items on queue to reindex and while it's not always happening that setup:upgrade is extremely slow I have seen cases where it will take a long time (even 15minutes) contrary to the normal ones when it needs a few seconds. Usually the queries running in the backend as showcased by mytop are related to MSI indexers running for stock or catalog rule pricing ones in our specific case. The best way I found to replicate this is to actually have a reindexing process running on an amount of data, that will lock the tables and then try to do a setup:upgrade. Because the lock exists, the process will hang for an indefinite period of time until the lock is released. But in spite of this side-effect, the underlying issue is still puzzling me. If I've decided to set my indexers to |
@kandy: maybe it helps if a senior developer could have a look here? The engcom squad seems to not understand this problem because I think they miss some deeper knowledge about this sort of complicated functionality of Magento. |
Same issue here on a busy store. |
Any solution? @joeshelton-wagento @ioweb-gr |
Not really, expecting Magento to confirm this is happening at the very least so a few more voices might help |
After an internal discussion and based on multiple complaints we confirmed this issue. Also, it is hard to predict final performance results. Theoretically, numbers should be better Suggested approach
cc: @ioweb-gr @hostep |
@engcom-Hotel we are still seeing this in 2.4.6 |
I can confirm it is still happening in 2.4.6 |
Let me reopen it for further investigation. |
@magento I am working on this |
According to this comment #33386 (comment) and multiple complaints related to this issue, we are reconfirming this issue. Thanks |
❌ Cannot export the issue. This GitHub issue is already linked to Jira issue(s): https://jira.corp.adobe.com/browse/AC-2423 |
Apparently it's not working properly though |
Hi, |
Hi, in order to battle this core issue, we use the following module for a while now without any issue: |
I have a fairly large catalog on a website and I've noticed that sometimes setup:upgrade takes a very very long time to complete. More than 30 minutes.
It's not always occuring which makes it hard to track but by carefully examining what is happening I noticed that the command is dropping and recreating the database triggers when the indexers are set on scheduled mode. However with the indexers on save mode, the backend takes a very long time to save products and especially categories.
So our only option on big catalogs is to use the indexers on schedule mode.
By examining further I went and forced a check on the mview_state table to see what script is changing the indexer mode during setup:upgrade and so the command threw an exception as expected when executing the following query
Then I was able to see that the functions
\Magento\Framework\Mview\View::unsubscribe
\Magento\Framework\Mview\View::subscribe
Are executed for all indexers regardless, which will trigger dropping and re-adding the database triggers.
However dropping a trigger and recreating in a fairly large database is taking a long time to complete causing significant downtime.
It seems I'm not the only one facing this issue https://magento.stackexchange.com/questions/330245/magento-2-indexers-sometimes-switchon-their-own-to-update-on-save-when-config
Preconditions (*)
Steps to reproduce (*)
Expected result (*)
Actual result (*)
Additional Information
save
fromschedule
slowing it down immensely #33386 (comment)Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.
The text was updated successfully, but these errors were encountered: