9

The Project i am working on is based on multiple server which uses load balancer. The Problem is i can not maintain PHP session through out all servers.What is the best way to manage session over Load Balancer ... ?

ayaz javed
  • 186
  • 5

3 Answers3

10

i can think of these two methods for this purpose.

  1. Use a clustered web application server where the session are available for all the servers
  2. Use IP level information to maintain affinity between a user and a server
Muzammil Naseer
  • 1,131
  • 1
  • 11
  • 26
  • Thanks muzammil, its helpful,.. I think we can also Share user’s session information in a database or a file system on application servers. – ayaz javed Jun 03 '16 at 11:44
7

Working SSL & Load Balancer, it is common to put the SSL on the load balancing server, but not on the back end servers. So you only need one certificate on one server. The load balancer then talks to the back end servers using plain HTTP. This obviously requires that your back end servers are not directly accessible from the internet.This load balancer is responsible for decrypting the request, it will also be able to inspect the request for a jsessionid.

0

Dig the way to store session inside DB that maintains all of your multiple servers. Servers always get the same _PHPSESSID because of it's written as domain's cookie.

So if you know session ID — you know what to query from DB that serves sessions.