문제

What is the difference between storing sessions in file and in database?

도움이 되었습니까?

해결책

The primary difference is that fetching the session info from a database can be quite a bit faster than from a file system. This is partly because of DB caching, but also because if there are large numbers of sessions files the file system may not cope well with it. Most file systems start to degrade when there are a few thousand files in a single directory, whereas DBs don't run into this problem.

Other reasons include fine-grained security, replication, and/or sharding, all of which are meat and potatoes to DBMSes, but not to filesystems.

If you only have a few sessions it doesn't matter, but when there 10,000 or 10,000,000 sessions it definitely does.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top