#Sessions not expired?
17 messages · Page 1 of 1 (latest)
In config/session.php, there is a setting for the Session Sweeping Lottery, what's your value there?
'lottery' => [2, 100],
Alright, so that should fire off the following command for 2 % of the requests:
$this->getQuery()->where('last_activity', '<=', $this->currentTime() - $lifetime)->delete();
Since the table is so large, that SQL statement might be problematic. But the question is why it grew large in the first place (i.e. why the sweeping didn't do its job continuously)
If it's trying to run that query and it's slow, you should be getting really slow requests 2 % of the time. Last time I used the database session driver, I added a scheduled command to clean up old sessions instead and disabled the lottery
So do you think is only database-related? I can also switch to Redis istance
I would want to find out if the session sweeping is running at all, or why not
Redis is certainly usually a preferred choice for sessions, but I'm more interested in understanding the problem here than just switch to solve it
Note that if you switch, all sessions will be invalidated
yes I figured that, I'd rather throw users out than be without a disk 😄
Understandable of course. But can't you run some manual queries to clean up some table rows?
yes I just launched it, let's see how long it takes 😄
You might want to try with some LIMIT first, as the deletion might lock the table
I suppose you have an index on last_activity?
yep