How to set indexers to Update On Schedule mode in Magento 2

- Fire development, Magento 2

Magento 2 export CLI

In the following post, we describe small but efficient Magento 2 performance improvement. Below, you will discover how to enable the Update on Schedule mode for indexers. This little action dramatically increases the platform’s performance. More useful tips are available in our cookbook. Now, let’s see how to set indexers to Update On Schedule mode in Magento 2.

Issue

The performance of Magento 2 may be reduced by Update on Save mode. Therefore, a better practice is to set indexers to Update on Schedule mode. Thus, you optimize the performance of your e-commerce website. However, Update on Save is a default setting. It launches updates for indexed data as soon as a change is made in the Admin. So, you guess how many background actions are caused by everything you do in the Magento 2 backend section. Luckily, it is possible to reduce the load. You need to set indexers to Update On Schedule mode. Magento 2 uses a cron job to reduce the number of updates but still make your website packed with the up to date information.

The more admins work in the backend of your store, the higher the impact of the Update on Save mode is. At the same time, frequent import and export processes may also downgrade the performance of your website. The system triggers indexes constantly, consuming more and more resources, and degrading MySQL performance. The bigger your Magento 2 website is, the more time it takes to complete all updates.

As we’ve mentioned above, you need to set indexers to Update on Schedule to avoid this issue. Let’s see how to enable the performance-saving mode.

Solution

First of all, you need to view your current indexer configuration. Use the following CLI command:

You have to replace [indexer] with a space-separated list of indexers to show particular designations. If you omit [indexer], the system provides information about the mode of all indexers.

Now, let’s see how to specify the Update on Schedule indexer mode. You can use the following general command:

To set the Update on Schedule indexer mode, you need to choose the schedule option. It lets you update the specified indexers according to the cron schedule. 

If you choose realtime, the command sets the selected indexers to the Update on Save mode.

You can also specify a space-separated list of indexers or omit the [indexer] option to configure particular or all indexers like in the case of the previous command.

For further information, follow this link: Set Indexers to “Update On Schedule” mode.