Web Hosting Talk







View Full Version : PHP Session Clustering


kerplunk
11-02-2005, 04:19 PM
What is the best way to do PHP session clustering (distributed sessions) on a large site?

Is there an open source alternative to Zend Platform (which apparently does Session Clustering very well)?

What do most large websites use for session clustering? Probably JSP?


Thanks, guys. :)

BurakUeda
11-02-2005, 04:27 PM
did you check this (http://www.php.net/msession)?

kerplunk
11-02-2005, 08:12 PM
did you check this (http://www.php.net/msession)?
Isn't that pretty much PostgreSQL's version of MySQL's Memcached?

Ryan F
11-04-2005, 04:51 AM
I'm guessing most large sites who are doing session clustering aren't using PHP. If you're in the pre-planning phase of your site you may want to consider using Java or .NET.

If you want to do it with PHP I think you're stuck hammering the database and/or stuffing a cookie to track session info across machines.

Ryan

Elliot A
11-04-2005, 05:28 AM
It isn't too hard to do clustered sessions. PHP has a function to override the default session handlers caclled set_session_handler ( ) which you can use to plug into a database containing your sessions if your host won't allow you to setup msession.

PHP also has a MemCached implementation that could be useful for storing sessions aswell.

Elliot A
11-04-2005, 05:41 AM
Ryan:

There is nothing special about using a different language for clustered sessions. Clustered sessions are usually handled the same way in any language, by either a shared filesystem, network daemon or by using the database. PHP contains the equivalents to anything that Java or .NET have.

At most you might need to compile something in or enable it in the php.ini but there is nothing wrong with the langauge when it comes to clustering.

m-b
11-04-2005, 05:52 AM
I wouldn't use a RDBMS for as a session store just to distribute session data!
That's somehow overkill and tends to kill performance. (although you could speed up reading through some chaching strategy)

I've seen two solutions in PHP for that problem:
One had a distributed filesystem (AFS) with partitions on every webhost (AFS implements ROWA, "read one write all").
The second one used "reliable group messaging" throug th spread toolkit ( www.spread.org ) which has a pecl-module.


Michael