On 07.03.2007 18:35, Greg Loriman wrote:
> Hi folks,
> 
> I posted this in railsweenie, but it's not really a rails question, and the 
> post isn;t getting any answers.
> 
> I'm not an experienced web developer. I'm still rather groping around. I 
> come from a client server background. I've plumped for Rails, although this 
> post's focus isn't really Rails.
> 
> I'm putting together a relatively simple site which I want to design from 
> the ground up for horizontal scalability, partly for the challenge, partly 
> because I need to learn and get experience. To help me do this I am going to 
> run at least two virtual machines to enforce the correct environment.
> 
> Currently my idea is to federate the data so that the users are divided 
> between the 2 or more machines, perhaps splitting alphabetically by user 
> name (ie. A-G to machine 1, etc). Where there is interaction between account 
> holders I am thinking of Drb'ing. Obviously rails is not going to be able to 
> do the interaction side of things, but I am fine with that; I'm prepared for 
> a bit of manual labour.

I am not sure whether I get your interaction correctly.  What types of 
things would have to be dealt with between users that are not done 
through persistent state?

> I would love comments/advice on my above ideas, and further insights into 
> horizontal scaling.
> 
> But also....
> 
> To facilitate the above I need some kind of proxy in front of the two 
> machines directing incoming requests to the correct machine based on the 
> login name which will be part of the url. Here I come unstuck since I have 
> no idea how to do this.
> 
> There must be proxies of this kind, but I'll be blowed if I know what an 
> appropriate one would be, or where to start in making it do what I want.
> 
> Can anyone give me a few pointers? Is squid the thing? Mongrel (I don't 
> really know what mongrel is)? Can apache be made to do this, and if so is it 
> a bad idea? Obviously it needs to be pluggable since I'll be using my own 
> code (C or Pascal) to do the lookups for the redirection.
> 
> Thanks for your words of wisdom,

Just a quickie as I'm on my way out: your Drbing will certainly hurt 
horizontal scalability - apart from the issue of finding instances etc. 
  If possible, you should build you app in a way that it does not need 
this.  Ideally you create it so that each HTTP request can be satisfied 
by communicating with the backend store (database) only.

It's probably also ok to assume some session stickiness as load 
balancing routers can do that (for example based on IP) and this seems a 
fairly common scenario.  If not, you need some mechanism to make session 
information available to all app servers (either via the backend store 
or via some other mechanism).

Kind regards

	robert