Skip to main content

How to Enable Asynchronous Indexing in Magento 2 on Ubuntu

7 min read
Set up async indexing

Your indexers move to Update by Schedule, with cron installed and the queue consumers running.

Magento 2 indexes in the background once its indexers run Update by Schedule and cron is installed. This guide shows how to switch the indexers, turn on asynchronous grid indexing, and run the message queue consumers on MySQL or RabbitMQ on Ubuntu, with the checks that prove it works.

Updated November 9, 2026. An earlier version of this guide set up Beanstalkd as a queue for Magento. Magento's queue framework has no Beanstalkd adapter, so that setup never reached Magento at all. This version covers what Magento actually supports.

Why Asynchronous Indexing?

If you have ever had a store slow to a crawl mid-day because a large import or a mass product update was reindexing as it saved, you already know the problem. In Update on Save mode, Magento does the index work inside the same request that saved the change, so the admin waits, tables stay busy, and on a large catalog customers feel it.

Asynchronous indexing moves that work into the background. Magento records what changed and a cron job catches up a minute later. The storefront stays responsive, imports finish faster, and the load is spread out instead of arriving as one spike.

In Magento 2 "asynchronous" covers three separate mechanisms, and a busy store usually wants all three:

  • Indexers in Update by Schedule mode, for the catalog, prices, stock, search and the other indexes.
  • Asynchronous grid indexing, for the admin order, invoice, shipment and credit memo grids.
  • Message queue consumers, for work Magento already sends through queues, such as mass attribute updates and bulk API operations.

None of them needs anything outside Magento except cron. RabbitMQ is optional and only matters for the third.

Step 1: Make Sure Cron Runs

Every part of this depends on the Magento cron. Install it as the user that owns the Magento files, not as root, and check that the entries are there.

cd /var/www/magento
bin/magento cron:install
crontab -l

Indexers run in the index cron group. To see whether it works, run that group once by hand. Any error lands in the terminal instead of a log nobody reads.

bin/magento cron:run --group=index

Step 2: Switch the Indexers to Update by Schedule

bin/magento indexer:set-mode schedule
bin/magento indexer:show-mode

In schedule mode, Magento adds database triggers that write every change to a changelog table, and the cron job in the index group processes those changelogs. Adobe's documentation describes it simply. Data is indexed according to the schedule set by your cron job.

One exception applies on older versions. Before Magento 2.4.8, the Customer Grid indexer does not support Update by Schedule. On 2.4.7 and earlier, put it back after the command above.

bin/magento indexer:set-mode realtime customer_grid

From 2.4.8 the Customer Grid indexer supports both modes and can stay on schedule.

Step 3: Turn On Asynchronous Grid Indexing

The admin sales grids are separate from the catalog indexers. By default, placing an order also writes the order grid row inside the checkout request. With asynchronous grid indexing, orders, invoices, shipments and credit memos go into temporary storage and cron moves them into their grids in bulk.

bin/magento config:set dev/grid/async_indexing 1
bin/magento cache:flush

The same setting is under Stores, Settings, Configuration, Advanced, Developer, Grid Settings. After the change, new orders appear in the admin grid after the next cron run, usually within a minute, instead of instantly. Tell the team that processes orders before you switch it on, so nobody reports missing orders.

Step 4: Run the Message Queue Consumers

Some background work in Magento already goes through its message queue framework. The supported brokers are RabbitMQ over AMQP, Apache ActiveMQ Artemis over STOMP from Adobe Commerce 2.4.5, and a MySQL adapter that keeps the queues in database tables. With no broker configured, the MySQL adapter does the job, which is fine for a small store. Adobe recommends an external broker for production.

To add RabbitMQ on the same Ubuntu server, install it and create a user for Magento.

sudo apt install rabbitmq-server
sudo rabbitmqctl add_user magento 'use-a-strong-password'
sudo rabbitmqctl set_permissions -p / magento ".*" ".*" ".*"

Then connect Magento to it.

bin/magento setup:config:set --amqp-host="127.0.0.1" --amqp-port="5672" \
  --amqp-user="magento" --amqp-password="use-a-strong-password" --amqp-virtualhost="/"
bin/magento setup:upgrade

Consumers are started by cron through the consumers_runner job. Each consumer processes a set number of messages, exits, and is started again on the next run. The defaults are sensible, and you can make them explicit in app/etc/env.php.

'cron_consumers_runner' => [
    'cron_run' => true,
    'max_messages' => 10000,
    'consumers' => [],
],

An empty consumers list runs all of them. To see what your installation has, and to run one by hand while testing, use these two commands.

bin/magento queue:consumers:list
bin/magento queue:consumers:start product_action_attribute.update --max-messages=100

Step 5: Check That It Works

Edit a product price or stock level in the admin, then look at the indexers.

bin/magento indexer:status

In schedule mode the Schedule Status column shows a backlog, for example idle (0 in backlog). Right after your edit the count rises, and after the next cron run it drops back to zero. If it only ever grows, cron is not running the index group. If an indexer sits at Processing and never finishes, our guide to Magento 2 indexers stuck at Processing covers the causes and the fixes.

Summary

Asynchronous indexing in Magento 2 is three settings and a working cron. Indexers go to Update by Schedule, the sales grids go asynchronous, and queue consumers run from cron on MySQL or, for a busy store, RabbitMQ. None of it needs Beanstalkd or any other software the framework does not support.

For help with Magento performance tuning, see our Magento 2 speed optimization service.

Frequently asked questions

How do I enable asynchronous indexing in Magento 2?

Switch the indexers to Update by Schedule with bin/magento indexer:set-mode schedule and make sure the Magento cron is installed, for example with bin/magento cron:install. Magento then records catalog changes in changelog tables and the cron job in the index group processes them in the background. Confirm the change with bin/magento indexer:show-mode, which should list every indexer as Update by Schedule.

What is the difference between Update on Save and Update by Schedule in Magento 2?

With Update on Save, Magento reindexes the affected data inside the same request that saved the change, so an admin save or an import waits for the index work. With Update by Schedule, database triggers record each change in a changelog table and the cron job processes the backlog later. The storefront and the admin stay responsive, and the indexes catch up within a cron run or two.

Can Magento 2 use Beanstalkd as a message queue?

No. The Magento message queue framework supports RabbitMQ over AMQP, Apache ActiveMQ Artemis over STOMP from Adobe Commerce 2.4.5, and a MySQL adapter that keeps queue data in database tables. There is no Beanstalkd adapter, so pointing the amqp settings in env.php at a Beanstalkd server does nothing useful. Indexing in schedule mode needs no message broker at all.

Does the Customer Grid indexer support Update by Schedule?

The Customer Grid indexer supports Update by Schedule only from Magento 2.4.8. On earlier versions it has to stay on Update on Save, so after running bin/magento indexer:set-mode schedule on 2.4.7 or older, set customer_grid back with bin/magento indexer:set-mode realtime customer_grid. From 2.4.8 the Customer Grid indexer works in either mode.

What does asynchronous grid indexing do in Magento 2?

Asynchronous grid indexing stops Magento from writing to the admin sales grids during checkout. Orders, invoices, shipments and credit memos go into temporary storage and are moved to their grids in bulk by cron. Turn it on with bin/magento config:set dev/grid/async_indexing 1. New orders then appear in the admin order grid after the next cron run instead of instantly.

Do I need RabbitMQ for Magento 2 message queues?

Magento works without RabbitMQ, because the MySQL adapter handles queues in database tables when no broker is configured. Adobe recommends an external broker such as RabbitMQ for production, since it scales better than database queues and the documentation advises against running several consumers on a MySQL queue. Connect RabbitMQ with bin/magento setup:config:set and the amqp-host, amqp-port, amqp-user, amqp-password and amqp-virtualhost options.

How do Magento 2 message queue consumers run?

By default the consumers_runner cron job starts the consumers. Each one processes a set number of messages and exits, and the next cron run starts it again. The cron_consumers_runner block in app/etc/env.php controls this with cron_run, max_messages, which defaults to 10000, and a consumers list, where an empty list runs all of them. List the consumers with bin/magento queue:consumers:list.

How do I check that Magento 2 indexing runs in the background?

Run bin/magento indexer:status. In schedule mode, the Schedule Status column shows idle with a backlog count, such as idle (0 in backlog). Edit a product, wait for the next cron run and check again. A backlog that grows and never drains means cron is not running the index group, which bin/magento cron:run --group=index runs once by hand so any error appears in the terminal.

Read how we handle it in DevOps for e-commerce.