MantisBT - Piwigo
View Issue Details
0002338Piwigodatabasepublic2011.06.12 00:142011.07.13 22:18
Apache 1.3.x
0002338: sessions table gets huge, use automatic purge
The only way to reduce size of #sessions table is to run the maintainance action "purge sessions". If you have a very popular gallery and don't like to repeat maintainance actions every week, an automatic purge would be better.

Maybe some code in include/common like:

if (mt_rand(0,100) == 0)
No tags attached.
Issue History
2011.06.12 00:14plgNew Issue
2011.06.12 00:14plgStatusnew => assigned
2011.06.12 00:14plgAssigned To => plg
2011.06.12 00:14plgbrowser => any
2011.06.12 00:14plgWeb server => Apache 1.3.x
2011.06.17 19:43rvelicesNote Added: 0005245
2011.06.17 20:27plgNote Added: 0005246
2011.07.13 22:16svnCheckin
2011.07.13 22:16svnNote Added: 0005329
2011.07.13 22:16svnCheckin
2011.07.13 22:16svnNote Added: 0005330
2011.07.13 22:18plgStatusassigned => closed
2011.07.13 22:18plgResolutionopen => fixed
2011.07.13 22:18plgFixed in Version => 2.2.4

2011.06.17 19:43   
Normally this is done automatically by php ini configuration.

on [^]

I think these work fine. However beware of robots - every hit generates a new entry in the table
2011.06.17 20:27   
Here is what we have on a standard Debian (which runs many web servers)

; This is disabled in the Debian packages, due to the strict permissions
; on /var/lib/php5. Instead of setting this here, see the cronjob at
; /etc/cron.d/php5, which uses the session.gc_maxlifetime setting below.
; php scripts using their own session.save_path should make sure garbage
; collection is enabled by setting session.gc_probability
;session.gc_probability = 0
session.gc_divisor = 100

; After this number of seconds, stored data will be seen as 'garbage' and
; cleaned up by the garbage collection process.
session.gc_maxlifetime = 1440

We can say that Piwigo uses its own session.save_path because sessions are saved in the database. I have a serious doubt that the session table will ever be automatically purged.

On Piwigo Demo, we had 5M (millions) sessions and 99,999% where out of date.
2011.07.13 22:16   
[Subversion] r11736 by plg on branch 2.2

-----[Subversion commit log]----------------------------------------------------
bug 2338 fixed: force purge on sessions table (each time a user gets connected)
2011.07.13 22:16   
[Subversion] r11737 by plg on trunk

-----[Subversion commit log]----------------------------------------------------
merge r11736 from branch 2.2 to trunk

bug 2338 fixed: force purge on sessions table (each time a user gets connected)