硬盘上的旧PHP会话文件[关闭]

Ok, please excuse me probably for being thick here or my lack of research on StackOverflow but currently under pressure to get a live server stable so researching on various options.

We noticed on our server (Windows 2008/IIS7) that the tmp folder had like a million session files (Garbage Collection seems not to be working), so could this be causing problems with load time on my PHP sites as for the past 2/3 weeks I have noticed load problems.

My theory is that when PHP creates a session and wants to read it, it has to go thru them million records to find my session.

Any thoughts, happy to be told my theory is totally crap.


UPDATE SO FAR
Clearing over a million session files seems to have reduced pressure on the HDD and PHP sites seems to be more responsive compared to previously. Waiting for the load to increase to see if these session files where causing the initial issue.

Since this is an I/O operation it will slow down when it accesses sessions at tmp directory. Check your php ini setting for http://php.net/manual/en/session.configuration.php#ini.session.gc-maxlifetime

I saw similar issue asked on serverfault check https://serverfault.com/questions/373024/php-processes-run-one-at-a-time-always-taking-100-of-one-core

php 5.4 provides a sessionhandler class to extend, so that sessions can be stored in a keyvalue extension, database or whatever. for older php versions there are similar functions.

this should be considered if sessions seem to be a bottleneck.