I have successfully configured to use mysql to save sessions data. I can see the data getting inserted in mysql. But I see the table keeps growing and it shows even those records whose expiry date is past. Wondering is there any configuration to prune the session table to remove records when the expiry date is past ?
Also I see it is growing super fast. I have deployed on our qa environment with ~7 users having access to the environment. In the last 7 days the records have reached around 850K, is this normal ?
Session lifetime should default to 24 hours. That sounds like a lot of data. Do you have a load balancer or something else that could be creating a lot of sessions?
Yes we have load balancer running behind grafana application. But I see the records staying in there forever, not getting deleted at all. Right now I can see records whose expiry date is June 2. I am looking for solution where the session info get deleted after certain time.
We use MySQL for session storage for Hosted Grafana so I’ve asked our team there to check if they have similar problems.
I will also try this out locally and see if I can recreate this. In the meantime, feel free to delete all expired sessions. This is the query that should be executed (86400 is 24 hours):
DELETE FROM session WHERE expiry + 86400 <= UNIX_TIMESTAMP(NOW())
I tested locally with MySQL (I’ve been using it for the last two weeks). And it seems to work but it is not obvious when the cleanup occurs. It is part of the Macaron web framework that we use. I did ask our Hosted Grafana team but didn’t get a reply. I’ll check with them again later in the week (4th of July today so they are out of office).