Expires rows from the session table older than a certain time.
Background
By default, Drupal ships with a session expiration time of just over 23 days, using this directive in settings.php:
ini_set('session.cookie_lifetime', 2000000);
However, for this to work automatically, it requires PHP's garbage collection to be configured correctly.
Since some distributions, e.g. Debian and Ubuntu do not ship with PHP defaults that triggers PHP garbage collection, there is a need to also set the following:
ini_set('session.gc_probability', 1);
ini_set('session.gc_divisor', 100);
This will work, but has some drawbacks:
- It will be triggered at some random time, rather than at a predictable time.
- It could slow the response for the unlucky user who happens to trigger it.
So, on sites with a distribution that is not setup as above, or on really 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.