Hi, I am wondering is there a problem using session when you are using load balancer? Logically, there is a big problem since session are kept in the server and data cant be shared btw servers. Wondering if there is any chance that PHP has features that handle that problem. THanks!
Session in load balancer
Is this any help?:
http://lists.freebsd.org/pipermail/freebsd-hackers/2003-December/004469.html
I don;t know much about load balancing so I don't know whether it is useful or not. I found it on google so you might be able to find some more helpful stuff on there!
If all the servers can have access to the same database server, then that server can host a database that stores the session data. Then session handler functions can be written so that PHP uses the database instead of its default local file method. If said DBMS supports replication, then that even that load can be spread across multiple machines.
Thanks guys, seems the db is a better way. Can you give me some directions to it? I want to be able to have the session data that mutiple servers can get the data via $_SESSION["myData"]. I dont know how it works. I dont want to write functions to manage the session because I know someone did it that way and turned out to be a maintenance nightmare. Thanks again.
Loop through your session array and concatenate them in a format such as name:value;name1:value; and insert this value to the database.
Split that same value from the database and loop the names and values back into session.
It's down right dirty, but it works.
You'll obviously need an identifier passed over to the different server so it knows which session data to use.
you could serialize() your $_SESSION array and save it to the db. PHP itself serializes the data to a file.