Forums / General / Good solution to get rid of old sessions.
Martin Kot
Monday 21 July 2008 7:21:13 am
I've got this typical eZ problem where the session table grows to quite unmanageable size after some time. I would like to get some tips on how to do it correctly. I did a small test with cleanup.php, eZ 3.9.1 where I ran:
[code] ./update/common/scripts/cleanup.php -s siteaccess expired_session[/code]
The script ran for a very long time, but the number of rows in table 'ezsession' was just the same afterwards. So I was kind of disappointed.
Then I found this extension, which looks promising, I haven't tried it yet though.http://projects.ez.no/session_cleanup
My question is, what are you guys usually doing/using to get rid of old sessions? If I don't get i to work, I'm probably just going to be a bit rude and run a cron script late at night that truncates the ezsession table. The database is mysql 5.0.11 and 4.1.11, InnoDB as engine type. I'm currently dealing with Exponential 3.9.1 and 3.8.4 respectively.
Ivo Lukac
Monday 21 July 2008 10:45:13 am
Hi Martin,
You probably have Debian or Ubuntu running on which PHP has an issue with session disposal. Your ezsession table is grown big so try giving to cleanup script more time (with -d set_time_limit). If it doesn't help I would try to cleanup all session and put your expired_session script in cronjob every night.
http://www.linkedin.com/in/ivolukac http://www.netgen.hr/eng/blog http://twitter.com/ilukac
Monday 21 July 2008 3:04:02 pm
That is correct, it is on Debian. Thanks for the suggestion, I am going to truncate the table and give the script another chance as a cron job.
Andreas Kaiser
Tuesday 22 July 2008 1:31:20 am
Hi,
we're launching a project where this could be an issue. We were planning to use Debian as server. What alternatives could we use...
Does this affect ezp4 or any ezp installed on Debian.
Because it's Debian related, it's related with this post?
http://oscarm.org/news/detail/666-debian_php5_and_session_garbage_collection
EDIT: I've been investigating this and found also these posts:
http://www.simplemachines.org/community/index.php?topic=211513.0 http://forum.kohanaphp.com/comments.php?DiscussionID=565http://issues.ez.no/IssueView.php?Id=12491&activeItem=1
So changing "gc_probability > 0" in php.ini could solve this?? I'm not very experienced with this, so please correct me if I'm posting nonesense ;)
Thanks,Andreas
eZ Partner in Madrid (Spain) Web: http://www.atela.net/
Tuesday 22 July 2008 4:03:59 am
Hi Andreas,
Don't know about this tweak but if you put cleanup of expired_sessions in cronjob every night your ezsession table should not grow (it size will depend on number of site users and session timeout settings)