Magento 2 Improved index management

With the release of Magenta 2.4.7, many performance and scalability improvements were introduced.

One of them is indexer management. Here Magento 2 introduced – Indexer Status Setting which allows admins to dynamically manage indexer status

bin/magento indexer:set-status suspended [indexer]
  • invalid—indicates that it is considered obsolete. This flag starts the re-indexing process on the next cron run, unless the indexer is specifically stopped.
  • suspended—Temporarily stops cron-triggered automatic updates for indexers. This pause in updates applies to both real-time and scheduled modes, ensuring that system-intensive operations are not interrupted by automatic updates.
  • valid—indicates that the indexer data is already up to date. In this case, there is no need to re-index.
  • indexer—indicates a space-separated list of individual indexers. If no specific indexer is mentioned, the configuration is applied universally to all indexers.

Administrators get the ability to customize the working status of the indexer, which is a key feature for improving system performance during demanding tasks such as data import or maintenance.

This feature provides fine-grained control over indexer activation, critical for managing system load during significant operations such as product updates.

By dictating indexer activation times through system cron jobs, administrators strategically optimize system resources. This granular control ensures smoother workflows and more efficient use of resources during large-scale operations.

For example, to suspend specific indexers, enter:

bin/magento indexer:set-status suspended catalog_category_product catalog_product_category

Result:

Index status for Indexer ‘Category Products’ changed from ‘valid’ to ‘suspended’.
The index status for the ‘Product Categories’ Indexer has been changed from ‘valid’ to ‘suspended’.

You can also add your own custom indexer by following this blog – Create Custom Indexer

Source link

Leave a Reply

Your email address will not be published. Required fields are marked *