[UPHPU] load balanced file-based sessions

Jon Jensen jon at jenseng.com
Tue May 6 11:53:51 MDT 2008


D'oh, Lonnie beat me.

If you want to know more about why NFS can suck, this paper is a good read:

http://www-static.cc.gatech.edu/classes/AY2007/cs4210_fall/papers/nfsOLS.pdf

> Are there any big websites that use file-based sessions or are they all 
> database-drive with huge clusters? We are using a database for sessions 
> currently but it cannot keep up and brings the site to it's knees.

Mozy uses database sessions and they work quite well. Some things you 
may want to consider:

  1. Modify your session handler so that it only reads/writes the 
session data as needed. In other words, if your session data doesn't get 
updated in a given request, don't serialize it. And if a given request 
isn't going to need any session data, don't read it.
  2. Make sure you are using persistent db connections! If every request 
opens and closes a new db handle, then you are in for a world of hurt.
  3. Consider making your session table in-memory only. This should 
speed things up.
  4. Minimize what you store in the session to things that you really 
need from page to page (e.g. $user_id).

> The last option I was considering was storing the session in a cookie as 
> an encrypted, serialized array. What are the groups thoughts on this?

Not a bad approach either, just be sure to follow #4 above to minimize 
overhead.

Jon


More information about the UPHPU mailing list