Magento: Handling Sessions

Magento Enterprise Edition uses PHP sessions to store customer session data.

The default method is to use the file system storage, which works well if you are using a single web server. Its performance can be improved by configuring the tmpfs in-memory partition to avoid extra hard drive I/O activity.
In a clustered environment with multiple web servers, the first option for handling sessions is to use a load balancer capable of associating client requests with specific web nodes based on the client IP or the client cookies. If you are in a clustered environment and not using a load balancer capable of the above-mentioned, it is necessary to share the session data among all web servers. Magento Enterprise Edition supports two additional session storage types that can be used in this case.

Though fully supported, storing session data in the database is not recommended as it puts an additional load on the main database, and therefore, requires a separate database server to efficiently handle multiple connections under load in most cases. However, storing session data in the database provides an advantage in case it's important to keep user sessions in case of any server crashes. Database-driven sessions will not be damaged when one or all servers in the cluster are down.

The memcached session storage is free of these disadvantages.
The memcached service can be run on one of the cluster servers to provide fast session storage for all web nodes of the cluster. Though, because of extra overhead processing compared to raw file system session files, the memcached session storage does not show any performance improvements when used in a single server configuration.

0 comments: