Use zstd compression
Preface
Shopware used gzip
(gzcompress) as standard for compressing the cache and the shopping cart up to Shopware 6.6. Since Shopware 6.6, zstd (Zstandard) can also be used as an alternative for compression.
The zstd compression algorithm is faster than gzip
and has a better compression ratio, which is why Shopware recommends its use.
Requirements
- Shopware 6.6
- Shopware Server
Check PHP extension zstd
Before the actual configuration in Shopware, it must be checked whether the PHP extension is available. The check can be carried out by creating a phpinfo() file, which is created in the document root.
# /var/www/vhosts/creoline-demo.com/phpinfo.php
<?php
phpinfo();
?>
Then save the file and call it up via your web browser.
You can then search the website for the following parameter so that you can directly determine whether the PHP extension zstd is already installed.
If zstd is not installed, the PHP extension can be installed as described in the following help center article: Installation zstd (Zstandard)
configure zstd in Shopware
After checking whether the PHP extension is installed on the server, the zstd compression can be configured in Shopware. To do this, open shopware.yaml
and add the following configuration to shopware.yaml
.
# config/packages/shopware.yaml
shopware:
cache:
cache_compression: true
cache_compression_method: 'zstd'
If zstd is also to be configured for the shopping cart in order to optimize the loading times of the shopping cart, add the following configuration:
# config/packages/shopware.yaml
shopware:
cart:
compress: true
compression_method: zstd
The cache must then be emptied completely. You can empty it in the Shopware administration or alternatively via the following CLI command.
bin/console cache:clear
If no error messages occur, zstd compression is configured and successfully applied.