Shopware 6 Background Queue Worker (user rights)

This article is limited to the setup and control of Shopware 6 Background Queue Workers with restricted rights. If you have root access to your server, please use the article: Shopware 6 Background Queue Worker Setup (Root Rights)


Shopware 6 uses so-called message queue workers to process background tasks and recurring tasks. In the standard configuration, these are executed via the logged-in administrator in the browser. As soon as more than one administrator is logged in, these message queue workers are executed multiple times and this can lead to a very high CPU load and problems with the execution of PHP FPM.



Adding the Shopware User Services

Log in via SSH with the deploy or management user and navigate to the systemd services of the active user with the following command:

cd ~/.config/systemd/user/


If the directory does not exist, please contact our support.


In the directory ~/.config/systemd/user/ all systemd services of the user are stored. To create the Shopware Message Queue Consumer, create the following file:

# ~/.config/systemd/user/shopware_consumer.service

[Unit]
Description=Shopware Message Queue Consumer
After=mysql.service
StartLimitIntervalSec=0

[Service]
Type=simple
Restart=always
RestartSec=10
Environment="MESSENGER_CONSUMER_NAME=consumer"
ExecStart=/opt/plesk/php/8.3/bin/php /var/www/mein-shop.com/httpdocs/bin/console messenger:consume async failed --memory-limit=512M --time-limit=120

[Install]
WantedBy=default.target


If you are using an older Shopware version, the default receiver must be added here as an alternative. Example for default receiver:

ExecStart=php /var/www/my-shop.com/httpdocs/bin/console messenger:consume failed default --memory-limit=512M --time-limit=120


In addition to the Message Queue Consumer, the service for the recurring tasks (Scheduled Tasks) is also required. To do this, create the following file:

# ~/.config/systemd/user/shopware_scheduled_tasks.service

[Unit]
Description=Shopware Scheduled Tasks Runner
After=mysql.service
StartLimitIntervalSec=0

[Service]
Type=simple
Restart=always
RestartSec=10
ExecStart=/opt/plesk/php/8.3/bin/php /var/www/mein-shop.com/httpdocs/bin/console scheduled-task:run --memory-limit=512M --time-limit=120

[Install]
WantedBy=default.target


Important: Ensure that the directory details are correct. In this example, the installation is located in the directory /var/www/vhosts/my-shop.com/. This directory only serves as an example and must be adapted to the correct path of your installation.



Control services

Use the following commands to start, stop and restart:

# Display status
systemctl --user status shopware_consumer.service
systemctl --user status shopware_scheduled_tasks.service

# Start service
systemctl --user start shopware_consumer.service
systemctl --user start shopware_scheduled_tasks.service

# Stop service
systemctl --user stop shopware_consumer.service
systemctl --user stop shopware_scheduled_tasks.service

# Restart service
systemctl --user restart shopware_consumer.service
systemctl --user restart shopware_scheduled_tasks.service



Service Autostart

For a service to be executed automatically when the operating system is started, it must be added to the autostart.

# Display status
systemctl --user is-enabled shopware_consumer.service
systemctl --user is-enabled shopware_scheduled_tasks.service

# Possible outputs: enabled / disabled

# Enable autostart
systemctl --user enable shopware_consumer.service
systemctl --user enable shopware_scheduled_tasks.service

# Deactivate autostart
systemctl --user disable shopware_consumer.service
systemctl --user disable shopware_scheduled_tasks.service



Service Daemon Reload

If you make changes to services that are already active, the systemd daemon must be reinitialized. This can be carried out using the following command:

systemctl --user daemon-reload



Extended information

For the automated start of user services, please contact our support team or use our live chat. If background execution has not been activated by our support team, the user service will not be executed permanently.