Skip to content

Use Redis Session Handler #26

@DaSourcerer

Description

@DaSourcerer

As a redis server is already part of the infrastructure and the redis PHP extension is being installed anyways, it is probably a good idea to use it as a session storage as well. This will introduce no code changes and may help relieve the host system of i/o pressure. Per this example, the following configuration changes are needed:

session.save_handler = redis
session.save_path    = "tcp://127.0.0.1:6379?persistent=1"

This can be further improved by eliminating the TCP/IP overhead when using unix sockets directly:

session.save_path    = "unix:///var/run/redis/redis.sock?persistent=1"

With regards to #24, msgpack could be used as a session serialization format:

session.serialization_handler = msgpack

⚠️ Changing the serialization format will require clearing all sessions!

On a related note it may be worth investigating if the I/O scheduler on the host is adjusted correctly. By default, Linux is using the cfq scheduler which is intended for interactive tasks. Server and virtualized environments may profit from deadline (recommended for Amazon, btw) or even noop. The default is controlled by the elevator kernel parameter. Check the settings for existing devices with cat $(find /sys/devices/ -name scheduler).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions