[SOLVED] g3_sessions Database Size

MysticMTL

Joined: 2009-12-06
Posts: 27
Posted: Sat, 2010-10-09 15:50

I updated to Gallery 3.0 mostly because of the better way G3 handles cache files, and with 20,000 photos, I was using up over 200,000 files, near the file limit of my webhost (1&1). So far Gallery 3 has reduced my files by over 100,000!

However, now my issue is with the database usage. My host also has a limit of 100mb, and I've never had this issue in the past, but after going to sleep last night, everything was working fine. And I woke up about 7 hours later and my database is now 99.1mb, and climbing!
and
I did quite a bit of research before opening up a topic about this, and was able to find out how to check what was taking all the space in the database. I went into phpmyadmin and found out that the g3_sessions entry was 65 megs, and growing every second. Thankfully I read that I could truncate this entry, and brought it back down to 0, but then it started climbing again. While I post this message, it's already 2mb and climbing.

Is there something I can do to have the g3_sessions entry automatically flushed? Or is there an underlying problem that I need to look at? I'm using the release version of Gallery 3.0, and it took about 2 days to transfer over my users and photos from my G2 installation. I'm using a separate database, with PHP5, since my G2 database was using PHP4.

Here is my phpinfo file for my gallery directory:

http://transitfan.com/gallery/phpinfo.php

And my gallery address is:

http://www.transitfan.com/gallery

Please let me know if you need any additional information.

Thanks in advance!

Edit: Here is some more information regarding my gallery3 installation:

Platform information

* Host name: Linux infong 2.4 #1 SMP Wed Nov 4 21:12:12 UTC 2009 i686 GNU/Linux
* Operating system: Linux infong 2.4 #1 SMP Wed Nov 4 21:12:12 UTC 2009 i686 GNU/Linux Linux infong 2.4 #1 SMP Wed Nov 4 21:12:12 UTC 2009 i686 GNU/Linux
* Apache: Unknown
* PHP: 5.2.14
* MySQL: 5.0.91-log
* Server load: 1.99 1.72 1.56
* Graphics toolkit: imagemagick

Gallery stats

* Version: 3.0 (Santa Fe)
* Albums: 1172
* Photos: 20063

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7994
Posted: Sat, 2010-10-09 23:29

Oof. I have the same problem! I hadn't noticed it, but my sessions table was 460M. I think that's happening here is that search engines are creating sessions much, much faster than they naturally expire. Most search engines don't propagate cookies forward, so they wind up with a new session each time.

I just submitted some code to fix this. It'll identify all the popular crawlers and keep them from creating a session in the database. Grab the latest experimental code, truncate your sessions table and try it out.
---
Problems? Check gallery3/var/logs
bugs/feature req's | upgrade to the latest code | use git

 
MysticMTL

Joined: 2009-12-06
Posts: 27
Posted: Sun, 2010-10-10 02:00

Great! You and your team is amazing!

Quick response and fast fix!

I'll update with the experimental code now and let you know what happens.

Thanks!

 
MarkRH

Joined: 2007-05-25
Posts: 241
Posted: Sun, 2010-10-10 02:45

Hmmm.. I'll have to grab this. Glad I saw this before I swapped my gallery3 install to my gallery.markheadrick.com sub-domain which is linked to all over the place.

Thanks,
Mark H.

Using Gallery 2.2.6 - gallery.markheadrick.com

 
MysticMTL

Joined: 2009-12-06
Posts: 27
Posted: Sun, 2010-10-10 14:32

Ok I updated the gallery to 3.0+git and checked out the g3_sessions usage. It was at about 200kb last night, and this morning it was back again at 12,000kb. And 56mb of used database space. When I truncated the 12,000kb of space from the g3_sessions in the database, and went back to the usage page, it still said 56mb in use. What I can figure is that the g3_sessions gave me a false reading for a second, and was infact functioning as it should, since the database size didn't change when I truncated g3_sessions.

I'll keep you informed if something changes.

 
MysticMTL

Joined: 2009-12-06
Posts: 27
Posted: Mon, 2010-10-11 00:52

Alright, 24 hours have passed since I updated the gallery with the new fix, and it seems to be working. My database size has remained constant.

My only question is that the g3_sessions size claims that it's 24,500kb now, but it is infact empty if I try and empty it again, so it's not taking any space any longer. So even if I truncate it back to 0kb, it doesn't take any space anymore!

So I think this issue has been resolved!

Thanks!