adonisjs / auth

Official Authentication package for AdonisJS
https://docs.adonisjs.com/guides/auth/introduction
MIT License
191 stars 65 forks source link

Creating new session files while keeping the old ones! #167

Closed agtabesh closed 3 years ago

agtabesh commented 3 years ago

Package version

3.0.7

Node.js and npm version

v10.24.0

I'm working on a project in which there are almost 50k users which most of them are logged in. The proplem is that the sessions folders size keeps increasing day by day and I think the reason is that adonisjs create a new session file while keeping the old ones. after 1 week the size of sessions folder is 3GB. If it helps, I set session age to 90d.

thetutlage commented 3 years ago

You have to manually write a script to delete the old files by comparing their mtime. Also, I think, redis will be wiser choice in this scanerio

agtabesh commented 3 years ago

@thetutlage Is it natural to take all 3 Gigabytes of space for 50k users within less than 20 days (assuming all users logged in within these 20 days)?

according to ext4 file system sector size, 512 bytes, (sessions file are less than that but the whole sector will be equipped) and our 3 Gigabytes space, we can store more than 6 millions session file which is far from our need unless adonisjs create separate session file for each users page view.

thetutlage commented 3 years ago

Hard to comment from my side, since I cannot see how many files are there. It will require some debugging on your end and report if unnecessary are getting created and on which event the files are getting created

thetutlage commented 3 years ago

Closing since no response from the issue reporter and not actionable as well