Another quick tip for reducing server load: keep your sessions in memory instead of on disk. For a dynamic, high traffic site, like a very active message board, your disk is already busy handling all the database work. Take some load off it by moving session storage to memory.
On Linux operating systems, this is extremely easy. To create a RAM-disk, just mount a partition as a tmpfs file system. Most distributions will have already created one for you at /dev/shm, intended for POSIX shared memory, which goes mostly unused. You can read and write files to this partition just like any other, except the data resides in memory instead of on disk. That means anything you save here will be wiped out on a reboot or power failure, but sessions are transient by nature anyway.
For PHP apps, edit the php.ini configuration and change the session.save_path setting to the tmpfs partition you mounted, or to /dev/shm. Restart the web server and PHP will start creating its sessions in memory instead of on disk. Don’t worry too much about taking away memory from other applications — with over 4,000 concurrent sessions each containing several arrays of data, I’m using less than 20MB of memory, yet saving tons of disk activity.


