[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ic] moving sessions to mysql - no luck


DB wrote:
But before I go away, does anyone have a suggestions for keeping the sessions table from growing without bound? How old is too old for a session?
Make a shell script in /etc/cron.daily that does this:
mysql -u youruser --password=yourpassword -h yourdatabase server -e 'DELETE FROM session_mysql WHERE (last_accessed + INTERVAL 7 DAY) < NOW()'

(disclaimer, haven't tested the script, we have a perl script that's way more complicated than this, but thats the query we run)

7 days is a long time but allows for some debugging of old sessions. Otherwise 1 day is plenty (it only has to be greater than the expiretime on your sessions)

Another note: Either use myisam as the table type, or if using innodb turn off the primary key on code (make it a unique index instead). Innodb is very slow when using random primary keys (which I found out the hard way over the christmas rush :-/ )


--
Jonathon Sim <suppressed>
Senior Developer @ Zeald.com (http://www.zeald.com)

_______________________________________________
interchange-users mailing list
suppressed
http://www.icdevgroup.org/mailman/listinfo/interchange-users


Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.