Peter Rundle <[email protected]> writes:

> I've inherited a LAMP stack which uses the php session stuff to maintain a
> session with an authenticated user. A cookie gets sent to the user and upon
> it's return PHP retrieves the "session" from a file in the "sessions"
> folder.
>
> I would like to change the setup such that the site could be hosted on
> multiple web servers.

Use session affinity in your load balancer.  No, really, with PHP it will
almost certainly hurt less.  Sorry.

> The PHP sessions would then be badly broken because the user could
> potentially be directed to the "other" server depending on what load
> balancing solution was used, which would not have the matching "sessions"
> file. I do not want to use a solution that has the load balancer direct the
> user back to the same server because a lot of the reason for load balancing
> is for redundancy or to be able to take a server off-line to service /
> upgrade it etc.

At least using session affinity you get working applications, and only kill
sessions associated with the one back-end that got killed.  However...

> The multiple web servers would initially share a a single back-end DBMS
> server

...use the PHP session hooks to store the sessions in the database.  PEAR/PECL
probably has something useful in that regard.  May require application
changes; last time I used it, they did, but maybe PHP sucks less now.

> but in future would have their own dedicated back-end DBMS, with the DBMS
> servers using replication to keep in sync.

Well, assuming that your replication solution actually /works/, this is
impossible to distinguish from the previous solution.  If you have something
with sync delays, etc, you may have issues.

I suggest you deal with it then.

Well, or deploy shared storage other than the DBMS. ;)

> I am looking for documentation, user-groups, articles, advice etc that
> describe the pros/cons of different solutions to meeting this requirement
> and thought I might ask the collective wisdom of Slug.

I doubt you will find anything much more exciting that the above, but I don't
actually have much useful reference material on hand at the moment.

        Daniel

-- 
✣ Daniel Pittman            ✉ [email protected]            ☎ +61 401 155 707
               ♽ made with 100 percent post-consumer electrons
--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Reply via email to