stefangabos / Zebra_Session

A drop-in replacement for PHP's default session handler which stores session data in a MySQL database, providing better performance, better security and protection against session fixation and session hijacking
https://stefangabos.github.io/Zebra_Session/Zebra_Session/Zebra_Session.html
Other
172 stars 85 forks source link

HUGE number of session rows #21

Closed GitHubUserToo closed 5 years ago

GitHubUserToo commented 6 years ago

Any reason for a HUGE number of session rows? I would expect 50,000 - 300,000 maybe, but I have 1,469,143, and the table is 1.1Gb.

I do have expiration set to 60 days, but still, this seems excessive.

I also have slowlog entries like issue # 15 (GET_LOCKs) - if related?

Any suggestions? Thank you.

stefangabos commented 6 years ago

The huge number of session rows can indicate that something's wrong with starting the session and on each subsequent page a new session is created. It can also be because of having a huge number of visitors, visiting your website multiple times a day, each visit creating an entry for 60 days.

As for the slow queries I can only reiterate what I said at #15: it may be because you or your users are authenticated, in the same browser, with the same account, multiple times and doing things that take a lot of time to complete; during this time the row is locked and other sessions (same accounts, different tabs) will be unable to get these locks and will hang.

stefangabos commented 5 years ago

This is most likely because of #16 and therefore should now be fixed.