hi, 2009/12/17 Peter Rundle <[email protected]>: > G'day Sluggers, > > 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. 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.
right, using a database is the most common way to solve this. what options do you have code-wise? are you free to write your own session handlers? if so, there are quite a few ready-baked options: http://framework.zend.com/manual/en/zend.session.savehandler.dbtable.html and many others google will find for you. > The multiple web servers would initially share a a single back-end DBMS > server, but in future would have their own dedicated back-end DBMS, with the > DBMS servers using replication to keep in sync. this is a bit unclear to me. do you want real sync between multiple dbs, so the data is always consistent or just fail-over? real sync requires mysql cluster or similar, even master-master can produce inconsistency in the data seen by the application. to get real sync, a write has to make it to all nodes before being visible on any node, which is non-trivial, as mysql's built in cluster setup puts serious limitations on the way you can store your across different data-nodes. here's a tool i've had success with for failover: http://mysql-mmm.org/ key thing here is that you have to make some trade-off decisions - do i want things to be always up, always vs do i want to make sure i never lose anything, ever. > 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. can you give us any more general info about the setup? how much control do you have over each layer? can you change the application code? is my assumption this is hitting mysql correct? cheers justin -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
