Using memcached as a session store
Using memcached as layer that handles user defined caching using key-value pair is fairly common these days. Memcached can help reduce the load on MySQL servers [or any backend data store] for read intensive systems. More often people are using 2 or more front end servers that handle distributed load.
Having such a system in place exposes the applications to adapt to scenario where session is setup on a particular server that needs to be uniformly available across cluster. Memcached works really well as a sessions data store where any server sets a session and using inherent distribution and pooling capacity of Memcached the same is available to all machines in the cluster.
Making session handling based on Memcached is easy:
session.save_handler = memcached
session.save_path = "tcp://127.0.0.1:11211"
Where 127.0.0.1 and 11211 should be replaced if you are not using defaults. It’s now done but beware that Memcached is a in memory non persistent data store and hence if it fails for any reason all your users will loose their sessions
There are ways to tackle it but more on it later.
