Welcome Guest, Not a member yet? Register   Sign In
How to manage session on load balancing server?
#1

[eluser]Unknown[/eluser]
My application is hosted on 2 load balancing server (Let say A and B). Issue I'm facing is with session. When I create session on server "A" and due to load balancing if it point to server "B", in that case I'm not able to retrieve session value. Please suggest me what to do?
#2

[eluser]n0xie[/eluser]
Use database sessions.
#3

[eluser]Unknown[/eluser]
Thanks buddy!! I know that but I was looking for some other solution where less code modification required.. may be some server setup or any configuration etc...
#4

[eluser]jbreitweiser[/eluser]
Set up the load balancer to use ip address to decide what server to direct the user to. And set that ip lease to a day. That way you dont have to worry about it in code.
#5

[eluser]Unknown[/eluser]
Perhaps your load balancer allows you to configure a sticky bit (aka stickiness) to keep a visitor on one of the servers for a defined period.
#6

[eluser]Sarfaraz Momin[/eluser]
There are lots of issues with load balancers. For instance you won't be able to use much of remember it function if you are trying to use a non-db session. I have some projects where after putting lots of time finding solutions for this problem I found that easier way in this case is to convert it to DB sessions. I don't know why will it take lots of time to convert your session code to use DB. Try it and let see how it works. The community is here to help and we will surely do it for you too Smile.

-Sarfaraz
#7

[eluser]n0xie[/eluser]
[quote author="Binay Kumar" date="1266358564"]Thanks buddy!! I know that but I was looking for some other solution where less code modification required.. may be some server setup or any configuration etc...[/quote]
If you are using CodeIgniter, and using the standard CI Session library, then it's simply a question of switching it on. Nothing needs to change.
#8

[eluser]Peng Kong[/eluser]
Smile another reason to use CI sessions.




Theme © iAndrew 2016 - Forum software by © MyBB