How to ensure PHP session concurrency on multiple HTML servers?

well, this is a quite common problem, depending on which load balance
system you are using, let us first explain the problem itself:

You got 2 HTML servers, one databases server. If your load balancer
just randomly sends users to either of your HTML servers,
all PHP session variables would be created on one HTML server,
but would be missing on the other one.

There are quite a few ways to solve this, like one could setup
a NFS and let both HTML severs store their session data there.
Just because of the bunch of small files and the rapid access on those,
this is not a good solution, might slow down your application quite a bit.

Since some time PHP comes with the APC package, which offers central
session storage. We tried to setup APC a couple of time, it is just
too complicated and seems to be unstable too.


So what we would suggest to you: use sharedance daemon.

Check it out here.

Works great, easy to setup,stable and quite speedy!

Another way of solving this is running memcache, which is available from Debian repositories at least since sarge, and using memcache as session handler in the php.ini config. More will be added about that soon!

You cannot comment on this entry