Redis seems to be the backend of the future for large Magento installations, because of its speed and ability to handle Magento’s cache tags. Now if you have all your cache blocks in a blazingly fast memory store, it would be nice if PHP would also save its sessions there (in stead of the slow file/database backend).

I got it working by adding these lines to local.xml (assuming you have the excellent phpredis extension installed):


And modifying app/code/core/Mage/Core/Model/Session/Abstract/Varien.php of the latest Magento source. Add this block at line 62, just before “default”:

case ‘redis’:
                ini_set(‘session.save_handler’, ‘redis’);

That’s it! Another expensive i/o operation eliminated.

AFAIK the source code modification is required, because Magento only uses the save_path from local.xml for a fixed set of handlers. Alternatively you could set session.save_path in php.ini (but this doesn’t work in a generic hosting environment like ours).

NB: for Byte customers, we’re currently evaluating Redis as a backend system. If it turns out to be as good as it promises to be, we will enable it for all our customers.

Scan je eigen Magento shop op veiligheidslekken

Related Post