[horde] Increasing horde performance through layered sessions

Myke Place mp at xmission.com
Sun Mar 13 22:05:30 PST 2005


<gwm> (sorry, I don't know your proper name) in #horde turned a few of 
us onto a very useful PHP tweak and I thought I'd share the details with 
the mailing list.

We've been seeing our dual-Xeon webmail server run really hot after our
upgrade to Horde 3.x and we had been noticing many Apache processes
waiting for the kernel to lock session files. Of course, this was no
surprise with over 7K active session files. The kernel was having a hell
of a time trying to wade through all those files in a single directory,
thus driving load up to 7.0 or higher on a busy morning and causing long
waits for our users. 

Luckly, PHP has a solution to this problem. As described here
[http://us3.php.net/session], an optional parameter can be added to
session.save_path in php.ini which allows PHP to use hashed directories
to store session files. To do this you must run mod_files.sh (included
in the PHP source) and you _must_ do your own garbage collection because
PHP will no longer handle it for you.

After creating a layered directory structure and setting
session.save_path="3;/var/cache/apache/sessions" in php.ini, our load
has dropped from 7.0 to 0.15. A dramatic improvement. For those
interested, graphs showing the drop in load and CPU can be seen here:

http://www.xmission.com/~mp/misc/webmail.png
http://www.xmission.com/~mp/misc/webmail_cpu.png

Per Jan's request, a note on this has been added to docs/PERFORMANCE for 
future releases. I'd be interested to know of other people experience 
similar dramatic results.

-Myke Place
XMission Internet
www.xmission.com


More information about the horde mailing list