Drupal sessions table getting huge
Over the last few months, my drupal sessions table has ballooned to several GB. It seems to have started when I upgraded to drupal 5.20 (previously I thought drupal automatically cleaned out old sessions). So I created a cron job to delete sessions older than two weeks, but this takes far too long to execute (the sessions table grows by about a million rows per week). Should drupal actually be handling this, or do I just need to cut down the maximum session age until the execution time is acceptable?
Also, I thought drupal was not supposed to create a session on the first request, thus eliminating many garbage entries for crawlers. But at least a q开发者_如何学Pythonuarter of the session entries are bots.
Came upon this when I researched the issue again.
This is caused probably due to: stock PHP configuration in some linux distros means no PHP session garbage collection runs. So Drupal session cleaning function that's supposed to clean old session from DB never runs... .
See all about it here: http://www.rymland.org/en/blogs/boaz/2_jan_09/making-php-session-expire-drupal-and-general
It sounds like a bug in your code somewhere. Drupal shouldn't create a session on first request for that exact reason.
Drupal updates are only bugfixes/security fixes for Drupal 6 and lower. So I don't see why upgrading could have caused the problem.
Have you altered Drupal core in any way?
精彩评论