Drupal Session Table Grows Huge

Over the past few months, my drupal session table has grown to a few GB. It seems to have started when I upgraded to drupal 5.20 (I previously thought drupal automatically cleared old sessions). So I created a cron job to delete sessions older than two weeks, but it is too long to complete (the session table grows by about a million rows per week). Should drupal handle this, or do I just need to reduce the maximum session age until the runtime is acceptable?

In addition, I thought that drupal should not create a session on first request, thereby eliminating many trash entries for crawlers. But at least a quarter of the session entries are bots.

+3
source share
2 answers

It sounds like an error in your code somewhere. Drupal should not create a session on first request for this exact reason.

Drupal Updates are only security fixes for Drupal 6 and below. Therefore, I do not understand why the update could cause a problem.

Have you somehow changed the core of Drupal?

+1
source

Came to this when I explored the problem again.

This is probably due to: having a PHP configuration on some linux distributions means that the PHP session is not garbage collected. Therefore, the Drupal session cleanup function, which should clear the old session from the database, never starts ....

: http://www.rymland.org/en/blogs/boaz/2_jan_09/making-php-session-expire-drupal-and-general

+3

Source: https://habr.com/ru/post/1743993/


All Articles