eZ Community » Forums » General » ezsession table size (700+ Mb)
expandshrink

ezsession table size (700+ Mb)

ezsession table size (700+ Mb)

Tuesday 21 November 2006 9:38:52 pm - 12 replies

Hey,

One of our eZp site is getting his ezsession table really big. Actually, it's 720 Mb large, 519 093 entries.
Its running 3.6.1 so it might be a bug, i want to upgrade to 3.6.11.

I would like to empty the table before i upgrade.
Can i just drop everything in this table or it will break something ?

Thanks,
Ronnie.

Tuesday 21 November 2006 10:32:53 pm

You can empty the table. This will invalidate all your sessions, that means all logged in user will get kicked out and need to re-login.
So, it's best to take the whole site offline before that, but i guess, you will do this for the update anyway.

Don't drop the table, just "delete from ezsession" and remove all entries with this.

Tuesday 21 November 2006 10:35:48 pm

There's a script called cleanup.php in common/scripts. You can use this to clean all sorts of things in the DB, including all sessions, or only expired sessions if you prefer.

As with anything else, I'd run a backup first, just to be on the safe side.

Tuesday 21 November 2006 11:55:53 pm

Great !
Thanks for the tips.

Wednesday 22 November 2006 5:44:12 am

I just added a feature request that I think would help this issue - better control of anonymous sessions either by them timing out sooner or by disabling the storage of anonymous sessions entirely:

http://issues.ez.no/IssueView.php?Id=9536

...of course, even if this is implemented it will still be necessary to clean up expired sessions regularly like Joe explained, or with a cron job.

Matthew

Wednesday 22 November 2006 10:11:19 am

You have a script:

./update/common/scripts/updatesession.php

See the details, but that's able to clear only the old sessions and keep the current onces. Put that into a cron.

X+

Friday 01 December 2006 8:06:28 am

When I try to run the update/common/scripts/updatesession.php, I get the following error immediately back:

Fatal error: eZ publish did not finish its request
The execution of eZ publish was abruptly ended, the debug output is present below.

Saturday 02 December 2006 10:26:09 am

Hi,

looks like a php-cli problem. like the php-mysql extension isn't installed for the cli or wrong php version or something like that.

Saturday 09 December 2006 1:29:36 pm

I believe the error you encounter is indeed a php-cli problem, possibly a reference problem.

I have encountered this problem, solved it on several occasions and documented my efforts and results.

The following reading should bring you up to speed as well as show you step by step how to solve this problem.

<i>http://ezpedia.org/wiki/en/ez/references
http://ezpedia.org/wiki/en/ez/sol...blish_command_line_scripts</i>

Cheers,
//kracker

Monday 12 March 2007 10:55:30 pm

Hi Xavier,

regarding your reply from Wednesday 22 November 2006 10:11:19 am:

I looked at ./update/common/scripts/updatesession.php and I can not find any DELETE statement, only UPDATE. Are you sure that the script is capable of clearing sessions from the ezsession table?

I am using eZ publish 3.8.8.

Cheers, Meinhard.

Monday 12 March 2007 11:05:45 pm

My bad,

./update/common/scripts/cleanup.php expired_session

is your friend.

X+

Tuesday 13 March 2007 4:15:39 pm

I don't think the script can clean all siteaccesses at once, so I did this (BASH):

for siteaccess in `ls ./settings/siteaccess`; do
  /usr/bin/php4 ./update/common/scripts/cleanup.php -s $siteaccess expired_session
done

Replace /usr/bin/php4 with your PHP path and you should be sorted.

Monday 07 May 2007 2:12:59 pm

There'a also a cronjob extension which cleans up the sessions:

http://ez.no/community/contribs/cronjobs/session_cleanup

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu