sessions in mysql table

adam

Administrator
Staff member
Dec 5, 2009
2,043
108
63
Just to let you know that this is one of the priorities for the next release, to reduce the data build up in the sessions table. In the mean time clearing anything older than a day should help.
 

paypal1352

New Member
YetiShare User
Wurlie User
Mar 2, 2012
297
2
0
could i possibly trouble you for an sql command that i could add to the auto_prune file to delete any sessions older than a day, sql is something im not very proficient at.

i thought $db->query('DELETE FROM `sessions` WHERE `updated_on` < :updated_on', array('updated_on' => time() - (60*60*24*14))); thats already in the auto_prune did this but i guess not
 

enricodias4654

Member
YetiShare User
Jan 13, 2015
411
1
16
You can also remove anything with data = '' older than few hours. Changing the id field to binary(8) would cut the id size and the index by half. You can store md5 values with 8 bytes, just use the function UNHEX in the queries.

In my code I removed the plugin data from the sessions.
 

enricodias4654

Member
YetiShare User
Jan 13, 2015
411
1
16
adam said:
Just to let you know that this is one of the priorities for the next release, to reduce the data build up in the sessions table. In the mean time clearing anything older than a day should help.
Hey Adam, have you already analyzed the possibility of using memcache for sessions? Here are 2 code examples: http://php.net/manual/en/memcache.examples-overview.php

You can also cache objects in memory. I know some users doesn't use dedicated servers for yetishare (they should), but you could make the use of memcache optional, as an alternative to the current method. You still need to reduce the amount of data saved to prevent using 4gb+ ram with session data.
 

adam

Administrator
Staff member
Dec 5, 2009
2,043
108
63
Yeah I think the first thing is to reduce the amount being stored in the session, or at least the volume of session data. Memcache would be a great option but I'm not sure how many people would utilise it.
 

wski3731

New Member
YetiShare User
Mar 13, 2014
21
0
0
Just checked mine: 1 mysql mysql 8.4G Feb 5 16:07 /sessions.MYD
This definitely needs to be fixed lol
 

paypal1352

New Member
YetiShare User
Wurlie User
Mar 2, 2012
297
2
0
i added $db->query('DELETE FROM `sessions` WHERE `updated_on` < (UNIX_TIMESTAMP()-60*60*48)'); as recommended by Adam from an earlier post.

Its all the extra plugin data in there that makes the table huge. I believe this is resolved in 4.3.