4

I got big phpbb forum and 2 servers. Want to distribute http load from 1 webserver to 2 webservers. Did it already in the past but there was problem.

On both servers (1 and 2) was lighttpd. I used various load ballancers when user connect to server number 1 then balancer decided if he should be connected to lighttpd on server 1 or 2.

Everything was good, except load ballancing was round robin (random) and when user logged in on forum (some kind of session) and then in next page was redirected to second server he didn't have his session! So he must log in again but then who know where he will be next redirected.

Solution to this is to create sessions accessible from both servers. Then no matter from which ligghtpd user would access he would not have problems ( i think ). Where exactly is problem, i think its session files in tmp from lighttpd because session's from phpbb are in database which both servers can access. Another thing could be cookie from phpbb session writing there ip of server which was used to login and causing problems if ip previously wrriten in cookie was changed (second webserver).

Additional problem was, when user was redirected to webserver 2 he would gain ip adress of server which redirected him (not his own ip). It was like he got tunneled from server 1 --> server 2. Not redirected directly to server 2 as it should.

This both problems need help, what i need to do to let user use my website from 2 diffirent webservers (lighttpd in this example) without problems.

3 Answers 3

2

One word: haproxy - it will give persistant connections based on an ip hash, and will fix all your problems, including the tunelling ip.

1

I've solved this in the past in one of two ways. Way #1 involved setting a cookie on the users machine with all the session information needed. Way #2 is to use a loadbalancer that will do persistent connections - meaning when a connection comes in from a user as long as they are actively using your site they will stay on whatever server the LB initially placed them on.

0

Or just set up an NFS server fot the shared session directory and then mount it on both webservers.

You must log in to answer this question.