Skip to content

v2.6: Implement batched session cleanup to prevent database issues

Choose a tag to compare

@thorewi thorewi released this 17 Aug 12:04
· 4 commits to main since this release
PHP's inline session garbage collection performs a single bulk DELETE,
which causes lock contention, Galera write-set overflows, and can lead
to unbounded session table growth and PHP-FPM saturation on large datasets.

This change introduces `SessionCleaner` to delete expired sessions in batches.
It provides a new `session:cleanup` console command for robust cron-based
cleanup and configures the `Handler::gc()` to also use limited batched deletion.

Requires an index on the `expiresAt` column for efficient deletion.