# Mananging multiple backends servers

**URL:** <https://www.ruby-forum.com/t/mananging-multiple-backends-servers/116195>\
**Category:** Rails\
**Created:** [October 3, 2007, 11:23am UTC](https://www.ruby-forum.com/t/mananging-multiple-backends-servers/116195 "2007-10-03T11:23:13Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ant](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/85e7bf/32.png) [@ant](https://www.ruby-forum.com/u/ant)\
**Post date:** [October 3, 2007, 11:23am UTC](https://www.ruby-forum.com/t/mananging-multiple-backends-servers/116195/1 "2007-10-03T11:23:13Z")

</div>

Hi all,

does anybody know of a tutorial that gives advice about the best way  
to run multiple rails applications on a cluster of physical servers  
with a load-balancer sitting on top. At the moment I am running pound  
on a server that acts as a load-balancer and routes traffic to one of  
three backend servers all runnning mongrel clusters. Unfortunately  
although I have sessions stored in a database I am having problems  
with maintaining sessions between the backend servers. Therefore any  
advice, links to tutorials etc would be appreciated.

Thanks

Anthony

---

<div class="post-metadata">

**Author:** ![ant](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/85e7bf/32.png) [@ant](https://www.ruby-forum.com/u/ant)\
**Post date:** [October 3, 2007, 11:36am UTC](https://www.ruby-forum.com/t/mananging-multiple-backends-servers/116195/2 "2007-10-03T11:36:04Z")

</div>

On 03 Oct 2007, at 11:22, Ant wrote:

> does anybody know of a tutorial that gives advice about the best way  
> to run multiple rails applications on a cluster of physical servers  
> with a load-balancer sitting on top. At the moment I am running pound  
> on a server that acts as a load-balancer and routes traffic to one of  
> three backend servers all runnning mongrel clusters. Unfortunately  
> although I have sessions stored in a database I am having problems  
> with maintaining sessions between the backend servers. Therefore any  
> advice, links to tutorials etc would be appreciated.

Check out my forum post at [http://forums.rimuhosting.com/forums/](http://forums.rimuhosting.com/forums/)  
showthread.php?t=389

Best regards

Peter De Berdt

---

<div class="post-metadata">

**Author:** ![ant](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/85e7bf/32.png) [@ant](https://www.ruby-forum.com/u/ant)\
**Post date:** [October 3, 2007, 12:11pm UTC](https://www.ruby-forum.com/t/mananging-multiple-backends-servers/116195/3 "2007-10-03T12:11:47Z")

</div>

Hi Peter

Thanks for the reply. I have pound running already. Do you think that  
having the “X-Forwarded-For” may cause problems with sessions? Because  
apart from the sessions thing, it’s working.

best wishes,  
Anthony

---

<div class="post-metadata">

**Author:** ![ant](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/85e7bf/32.png) [@ant](https://www.ruby-forum.com/u/ant)\
**Post date:** [October 9, 2007, 3:12pm UTC](https://www.ruby-forum.com/t/mananging-multiple-backends-servers/116195/4 "2007-10-09T15:12:35Z")

</div>

Hi Peter,

I finally tracked down the problem. It was simply that the backend  
server times weren’t in sync despite being configured to use ntp  
(network time protocol). They were over an hour apart. So I’m guessing  
that the default session expiry time is less than an hour. Until now I  
was having to use a ‘sticky’ cookie within my pound configuration such  
that my application cookie name matched that in the pound  
configuration and meant that all requests from the same client got re-  
directed to the same backend server.

However now that the times are OK, this is not necessary and I can now  
see that requests from the same client go to different backend servers  
depending on the load and sessions are maintained. So if anybody would  
like to know how to set up multiple backend servers behind pound for  
load balancing with mongrel clusters on each of the backend servers,  
please contact me.

Thanks

Anthony
