Magento sessions now properly cleaned

We’ve recently experienced a couple of outages for individual customers that exhausted the inode capacity on their Hypernode. That is techno-babble for “there were so many files that the disk was full” 🙂

This is an especially hard-to-detect problem for customers, because the maximum-number of files is difficult to monitor and measure. If you store too many large files, you will see this with known tools such as “du” or “df”. When the maximum number of files on disk is reached, these tools fail to deliver, because there is space in terms of megabytes, but not in terms of numbers.

It turns out that Magento normally cleans up sessions using the built-in PHP garbage collector. This garbage collector normally cleans up sessions once every hundred or so requests. That is nice, but this also means that it slows down one in every hundred requests. This is probably why Ubuntu has turned this feature off.

Then it turns out that the replacement feature Ubuntu ships does not work for Magento, because it only cleans /var/lib/php/. Magento changes the session path to /data/web/public/var/session/. This means the Magento session path is not cleaned by default on Ubuntu.

But now it is.

We’ll roll out this cleaning feature today.

 

PS: This was filed as release 403, but it took a bit more testing, so it became 405 🙂