Welcome to WebmasterWorld Guest from 54.162.227.136

Forum Moderators: open

Message Too Old, No Replies

PHP Sessions & Hard Drive integrity

Creating and unsetting many sessions; impact on hard drive

     
9:44 pm on Jun 6, 2009 (gmt 0)

5+ Year Member



Hello,

I've noticed that I'm using sessions quite a bit to keep track of data and plan on undertaking a project that will use even more sessions. From what I understand, when a session is created a file is also created on the server. My use of sessions involves creating them, and then unsetting them when I'm done with them; sometimes this unsetting occurs at the end of a page, sometimes soon after the session is created.

I'm concerned that all this session setting and unsetting will cause the hard drive to become heavily fragmented; especially with large amounts of traffic. Is there need for concern here or should I proceed with my project?

Thank you.

2:51 am on Jun 7, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If this is a Linux server, it won't be a problem at all. Linux is equipped to handle a large number of files, and fragmentation is rarely an issue, if ever.

Windows can choke on a folder with thousands of files, but if the overall site/server performance is good, the sessions really shouldn't make much of a difference.

3:26 am on Jun 7, 2009 (gmt 0)

5+ Year Member



Thank you mcavic. It will be a Linux server.
12:53 am on Jul 5, 2009 (gmt 0)

5+ Year Member



sometimes this unsetting occurs at the end of a page, sometimes soon after the session is created.

You might want to look into using memcache [php.net] (it provides a session.save_handler) , especially if you're creating and deleting sessions within the same request often.

Sessions don't have to be saved on disk.

4:35 am on Jul 9, 2009 (gmt 0)

WebmasterWorld Senior Member lammert is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



If there is no need to keep sessions during a server reboot, you can create a partition as an automatically sizing ramdisk with the tmpfs attribute in /etc/fstab and mount this partition at the location where you normally store your sessions. See man mount for more details.
 

Featured Threads

Hot Threads This Week

Hot Threads This Month