![]() For example, if your goal is to track a channel that brought the user to the site you could simply store that channel information in their cookie instead of the $_SESSION. That way your sessions table stays lightweight and you can still do tracking of the user inside the cookie. However, you might consider if you can instead store the data in the cookie instead of in the session. If you truly need to store session data for 2 years that's fine. The other class of users who got deleted after 3 months would be deleted in a job that ran overnight as it performed more operations and had more impact on server resources. For my scenario, 1 class of users who had not been active in the last hour were logged out so that job ran every hour. You can even run the select against a read-replica database to reduce the performance impact further. This had the greatest performance while having minimal impact. Instead, I wrote a loop that would find records to delete and then run individual delete queries with a condition WHERE sid = :sid so it was using a primary key. I found that trying to do a sql delete directly does not scale well. Saving the cookie data beyond that for what amounts to a rounding error is generally not super useful. 95% were within the first week and going out to 3 months got up to 98%. 90% of users who committed and got engaged did so within the first day. That said, I also found that user interaction followed a power-curve. The limit of your sessions table depends on database server hardware, but my experience on a fairly large site is that you can have millions of sessions records and it's not a huge problem for performance. According to system.install, that column contains The Unix timestamp when this session last requested a page. in drush) that will find stale sessions and delete them.įor item #2 for you that means it has to find the Internal users with a short lifetime and delete their session if the sessions.timestamp is beyond a limit.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |