Session
Shopware, by default, uses the session storage configured in PHP. On most installations, this is the file system. So, in smaller setups, you will not need to take care of sessions. For larger setups with a lot of traffic, or that are using clustering however, you will most probably want to configure alternative session storage such as Redis, in order to reduce the load on the database.

Session Adapters

Configure Redis using PHP.ini

As Shopware by default uses the settings configured in PHP, you can reconfigure the Session config directly in your php.ini. Here is an example to configure it directly in PHP.
1
session.save_handler = redis
2
session.save_path = "tcp://host:6379"
Copied!
Please refer to the official PhpRedis documentation for all possible options.

Configure Redis using Shopware configuration

If you don't have access to the php.ini configuration, you can configure it directly in Shopware itself. For this create a config/packages/redis.yml file with the following content
1
# config/packages/redis.yml
2
framework:
3
session:
4
handler_id: "redis://host:port"
Copied!

Other adapters

Symfony also provides PHP implementations of some adapters:
To use one of these handlers, you need to create a new service in the dependency injection and set the handler_id to the service id.
Example service definition:
1
<service id="session.db" class="Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler">
2
<argument ....></argument>
3
</service>
Copied!
Example session configuration:
1
# config/packages/redis.yml
2
framework:
3
session:
4
handler_id: "session.db"
Copied!