Redis

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):

<session_save><![CDATA[redis]]></session_save>
               <session_save_path><![CDATA[tcp://127.0.0.1:6379]]></session_save_path>

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

case ‘redis’:
                ini_set(‘session.save_handler’, ‘redis’);
                session_save_path($this->getSessionSavePath());
                break;

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