Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I'm managing a site which, despite our best efforts, creates upwards of 10,000 session files. We've configured the gc and it has helped to control somehow the growth of files, but we still have "a lot" of these files at peak hours.

Are 10,000+ too much session files? File size is not an issue, just wondering how many files are "too much" compared to your experiences.

share|improve this question

closed as not constructive by mgorven, Michael Hampton, Scott Pack, Ward, Khaled Feb 5 '13 at 8:07

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.

    
Have you looked at storing in a database, or memory? –  Zoredache Feb 4 '13 at 19:10
2  
First step is to identify if it's really an issue or these many files are above average; then look at other storage options. –  Jaime G. Wong Feb 4 '13 at 19:59
    
Meh, I generally prefer database storage as a rule, since it makes it easier for me to setup DR, and it is pretty easy to implement. But you are right, it is good to be cautious, and only make changes if you actually need them. –  Zoredache Feb 4 '13 at 20:53

2 Answers 2

up vote 2 down vote accepted

"Too many" session files? Well, you're gonna need one per session. So however many sessions you're willing to maintain, that's how many session files you're going to end up with. You can tweak how long the files persist via gc, as you've done, but short of reducing the number of clients (presumably not your goal), nothing's going to reduce the absolute number of files created.

That said, 10,000 files is not a shockingly large number for any reasonably modern filesystem.

share|improve this answer

Generally speaking you won't hit a problem unless the OS is 32-bit and you have billions of files. If you're concerned about file limits, make sure to use a file system designed for absurdly huge numbers of files. XFS comes to mind for this purpose. You can create a new volume, format it as XFS, and mount it wherever your PHP application writes its session files. This requires no modification of the application itself.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.