magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.47k stars 9.28k forks source link

400+ stores and try to Save configuration taking too much time and CPU spike > 100% #38973

Open jigar48 opened 1 month ago

jigar48 commented 1 month ago

Preconditions and environment

I have 400+ stores created in single Magento instance, I have autoscaling server with different Database AWS server.

There are 200k products.

Frontend and Backend both are hosted on AWS with autoscaling ability.

I have AWS elasticache Redis server configured in the env.php

Steps to reproduce

  1. Open Admin panel
  2. Go to Stores -> Configuration
  3. Just click on Save config button
  4. Check CPU usage on SSH
  5. It Spike to > 100% and Frontend servers are down

Expected result

It should not spike CPU to 100%

Actual result

image_2024_07_25T10_52_03_955Z

Additional information

I was trhoubleshooting this issue since month we think that it trying to clean Cache and Save cahce while saving configuration for 400 stores and that causing issue.

Release note

No response

Triage and priority

m2-assistant[bot] commented 1 month ago

Hi @jigar48. Thank you for your report. To speed up processing of this issue, make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:

hostep commented 1 month ago

Magento 2.4.7 comes with a solution for this I believe, see the new async config feature they introduced in version 2.4.7: https://experienceleague.adobe.com/en/docs/commerce-operations/performance-best-practices/configuration#asynchronous-configuration-save

(if you have a working cronjob, then there is no reason to manually run that bin/magento queue:consumers:start command they recommend, it should start up automatically via the cronjob, unless your configuration doesn't allow it)