In the docs, Magento advises us that we can set the MAGE_INDEXER_THREADS_COUNT environment variable:

run the reindex command using the environment variable MAGE_INDEXER_THREADS_COUNT, or add an environment variable to the env.php file

This is fine when you're able to update env.php, but on an architecture like Magento Cloud where we're unable to do so, it doesn't seem possible. I've tried defining the value in .magento.env.yaml, however this fails validation when running the ./vendor/bin/ece-tools cloud:config:validate command, this is because the variable name is not included in vendor/magento/ece-tools/config/schema.yaml

www-data@be66b9b25468:~/html$ php ./vendor/bin/ece-tools cloud:config:validate
Environment configuration is not valid. Correct the following items in your .magento.env.yaml file:
The MAGE_INDEXER_THREADS_COUNT variable is not allowed in configuration.

Is there any other way to set this value?

1 Answer 1


In Magento Cloud, you can set the MAGE_INDEXER_THREADS_COUNT environment variable in the .magento.app.yaml file. This file is located in the root directory of your Magento Cloud project and controls various settings for your environment, including environment variables.

To set the MAGE_INDEXER_THREADS_COUNT variable, you can add the following line to the variables section of the .magento.app.yaml file:


Where is the number of threads you want to use for indexing. For example, if you want to use 8 threads, you would set the variable as:


After you have set the variable in the .magento.app.yaml file, you need to deploy the changes to your environment.

magento-cloud deploy

Note that the change in this file will only affect the next time you deploy. It will not affect the current running environment.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.