Session files

We are estimating that we will accumulate appox 100 000 - 120 000 session files per day.


Is there a threshold on the number of session files and performance degradation in Matrix.



Currently in the session_cleanup.sh script the default is to keep session files for 7 days then remove them. If we follow this rule we'll have a large number of session files (800 000+) by the end of the week. This is in our low hit time of year as well.



Is there a recommendation an the length of time to keep session files.



Thanks

It depends on the site really. If you haven't got users logging in, then probably something like 12 hours would be safe.


I would also seriously look at using the memcache session handler in 3.20 for this. Then you wouldn't need to clean up session files, sessions are non-blocking, and it'll make your life a lot easier :slight_smile:

to clarify,


So a Matrix site running 3.16.10 or similar would not see any side affects (performance degradation) with a large number of session files in the cache dir?



thanks

You shouldn't really, no. Session files are access directly using their full path; the system doesn't do any listing or searching of the files.


The biggest problem is that it is difficult to manage lots of files from a system administration point of view. The other danger is that hitting directory size limits or inode usage limits can take the system offline, if PHP can't read/write to the session directory (depends on your filesystem though).