Understanding Session Expiry in Drupal

One of the most important modules, and one that is very frequently used in development involving Drupal, is controlling the expiry of rows from the session table older than a certain time. On busy sites, the sessions table can grow to be very large, and that can cause slow accesses to it, as well as slow writes due to locking, leading to performance bottlenecks.

By trimming the table regularly, the above bottlenecks are avoided.

Drupal uses the PHP garbage collection mechanism to clean up the sessions table, but this mechanism depends on PHP's configuration, and can fire for any session.

This module moves this functionality to cron, and hence is a background process, and is consistent and predictable regardless of PHP's garbage collection configuration.

Click here to read the full story.