In Shopware 6, many tasks process asynchronously, which means that the tasks are processed in messages in a queue and not at the time of execution. This process allows tasks to be processed independently of timeouts or system crashes. Possible tasks are sending mails, indexing products, or generating the sitemap.
Recurring tasks are handled via Scheduled Tasks. Scheduled tasks add tasks to the message queue at fixed intervals, which are then also processed asynchronously. For example, this includes generating an export for comparison portals or checking whether new updates are available.
Scheduled Task | Run interval (seconds) | Explanation |
log_entry.cleanup | 86400 | Empties the "log_entry" table |
shopware.invalidate_cache | 20 | Invalidation of the cache |
app_update | 86400 | Checks whether there is an update for the installed extensions |
app_delete | 86400 | Manually removes an extension and the associated plugin data from the Shopware database and the server files |
version.cleanup | 86400 | Deletes outdated version IDs from the database |
webhook_event_log.cleanup | 86400 | Deletes webhook event logs that are older than the set time |
sales_channel_context.cleanup | 86400 | Empties the "sales_channel_context" table |
product_keyword_dictionary.cleanup | 604800 | Empties the "product_keyword_dictionary" table |
product_download.media.cleanup | 2628000 | Deletes unassigned images |
delete_newsletter_recipient_task | 86400 | Deletes all unconfirmed newsletter recipients whose registration attempt was more than 30 days ago. |
product_stream.mapping.update | 86400 | Updates the mapping of dynamic product groups |
product_export_generate_task | 60 | Triggers the product export |
import_export_file.cleanup | 86400 | Empties the "import_export_file" table |
shopware.sitemap_generate | 86400 | Generates the sitemap |
cart.cleanup | 86400 | Deletes all shopping carts that are older than 120 (shopware.cart.expire_days) days. |
shopware.elasticsearch.create.alias | 300 | Triggers the creation of Elastic Search Alias, this is only executed when required. |
Some tasks such as shopware.elasticsearch.create.alias and shopware.invalidate_cache are only executed on demand. The Elasticsearch task is only executed if an Elasticsearch server is configured and activated.
In a standard installation of Shopware, message queue tasks are stored in the database and processed via the browser, provided you are logged into the Administration. This is a fast and straightforward method but is not recommended for production systems.
The functioning of the Admin Worker requires that the Administration is open for a more extended time; otherwise, tasks will not be processed. If many users are logged on to the Administration, this can lead to a high CPU load. It is advisable to disable the Admin Worker and run the processes server-side via the CLI. In this way, tasks are processed even if no one is logged into the Administration, and a high CPU load due to multiple users is also avoided. This approach is especially useful for larger stores.
The CLI Worker is a service that can be set up directly on the server. It is used for executing background jobs, where "CLI" stands for "Command Line Interface," meaning it can perform tasks via the command line. The CLI Worker handles tasks such as executing indexings and other processes that do not need to occur directly in the frontend of the Shopware admin. Commands can also be set up as cron jobs, allowing them to be regularly performed in the background.
You can find more information in our developer-documentation.
As explained, the use of the Admin Worker is not recommended for production systems. The following section describes how to disable the Admin Worker and run the Message Queue / Scheduled Tasks server-side.
The following settings are made directly on the server. Since the possibilities of the server configuration depend on the hoster, we explain this here generally. If you have questions about the operation of the server configuration, the support of your hoster should be able to help.
To disable the admin worker, you have to make the change in the shopware.yaml file so that the change is also update-safe. You can find it in your Shopware installation under config/packages/. If the file is missing, please create it.
Disable the admin worker by entering the value "false" and saving the file. Your file should now look like this:
# config/packages/shopware.yaml
shopware:
admin_worker:
enable_admin_worker: false
For the Message Queue and the Scheduled Tasks to be executed now, the processes must be started via the CLI.
Message Queue:
bin/console messenger:consume async low priority --time-limit=60
It is important to note that the command has changed as of Shopware version 6.5. The old CLI command with the value "default" will fail.
Scheduled Tasks:
bin/console scheduled-task:run --time-limit=60
We recommend the parameter time-limit=60 for the above commands to execute the command for a maximum of 60 seconds. Alternatively / additionally, you can define a memory limit instead of a time limit. This is possible with the parameter --memory-limit=512M. More information can be found in our developer doc.
It is important in this process that the commands are executed regularly so that the message queue is continuously processed. This can be achieved, for example, by creating a cron job or a service on the server. Contact your hoster for this.
In the next step, you should decide how you want to process the message queue. You can set up the above commands as a cronjob or configure the CLI worker as a service.
You can find more information about this here.
Some hosters provide articles describing how to set up there in their knowledge areas.
At Profihost, you can find more information about the setup under https://wissen.profihost.com/wissen/artikel/shopware-6-worker-im-hintergrund-laufen-lassen/
Hetzner provides the information under
https://community.hetzner.com/tutorials/install-shopware-6#step-6---configuring-background-queue-worker
Creoline provides the Informationen under
https://help.creoline.com/doc/shopware-6-background-queue-worker-einrichten-XLBEPcGmlt
Timme Hosting provides the Informationen under
https://timmehosting.de/shopware-6-admin-worker-deaktivieren