HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (http://www.howtoforge.com/forums/index.php)
-   HOWTO-Related Questions (http://www.howtoforge.com/forums/forumdisplay.php?f=2)
-   -   Loadbalanced apache web server with sticky sessions (http://www.howtoforge.com/forums/showthread.php?t=13434)

jorge.gonzalez 15th June 2007 12:14

Loadbalanced apache web server with sticky sessions
 
Hi all!

This is about Howto http://www.howtoforge.com/load_balan...proxy_balancer

It is supossed that, in byrequest mode, each request to main apache is switching between the two backend web servers and the session were still alive, isn't it? Then, why I have always been forwarded to the same backend apache? I mean, I tried with firefox, loged in wordpress testing app and, if I refresh page, then I'm again in the same backend web server. If I delete the cookie BALANCEDID then (maybe) the main apache forward me to the second backend server. What if backend apache is down? Does do failover?

If I try with konqueror (or other PC) then I am able to access to the other backend web server.

Then, the question is: Is the user always using the same backend web server and only the main apache switch between servers when there are different users?

Sorry for my bad english ;-)

thanks in advance

jorge.gonzalez 15th June 2007 13:24

working 50% ok
 
Well, I dont know why but reloading main apache web server it's working. But I see that if I stop one backend web server then all request go to the webserver which is up (failover ok)

Then if I start the stopped web server, request are not going to this server any more unless main apache web server was reloaded

jorge.gonzalez 15th June 2007 14:11

Answering myself
 
As Apache mod_proxy says:

retry 60 Connection pool worker retry timeout in seconds. If the connection pool worker to the backend server is in the error state, Apache will not forward any requests to that server until the timeout expires. This enables to shut down the backend server for maintenance, and bring it back online later.

Then 1 minute without balancing (two servers), after 1 min everything works ok :-)

falko 16th June 2007 13:47

Quote:

Originally Posted by jorge.gonzalez
It is supossed that, in byrequest mode, each request to main apache is switching between the two backend web servers and the session were still alive, isn't it?

No, if the requests were switching between the backend servers, then you'd lose the session. Therefore requests from one client always go to the same backend server (unless you delete the cookie on the client PC or use another browser on the client PC).

Quote:

Originally Posted by jorge.gonzalez
Then, the question is: Is the user always using the same backend web server

Yes.

Quote:

Originally Posted by jorge.gonzalez
and only the main apache switch between servers when there are different users?

Yes.

jorge.gonzalez 18th June 2007 11:12

Then, I don't understand
 
Falko, I can't realize what is going on. As I said I have 2 wordpress (wp1 & wp2) running on backend servers and one server acting as primary (wp), balancing requests.

As you know wordpress has a login procedure with session and cookie. My primary server is balancing between backend servers and is keeping the session!!

Now my browser is logged on wp1. If page is reloaded then I will be in wp2 and also logged. It's easy to see the alive session because I can access to site admin (link) whatever I were wp1 or wp2. If I log out then in both WP's there's no site admin link but login link

Still more. Let's try
I'm going to stop wp2 (now I'm on it) server while I'm logged: Ok, wp jumps to wp1 with the session alive because wp2 is down. 1 minute and wp2 will be up, then wp should to jump to wp2 and the session should be there.... Ok, wp2 is up and I wp is switching between wp1 & wp2 with the session.

Let's try with wp1. Session logged. wp1 down, working with wp2. 1 minute later wp1 is up and wp is switching between 2 backend servers with the session still alive.

How do you explain that?

falko 19th June 2007 13:33

Does WordPress store the sessions in the MySQL database? If so, and both WP installations use the same database, then you don't lose the session, even if you're switching between the backend servers.

jorge.gonzalez 19th June 2007 15:25

That is
 
Yes, WPs are working with the same DB and stores sessions in DB.
Thanks Falko :)


All times are GMT +2. The time now is 02:35.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.