[dundee] Rails work
Barry Carr
barry at benericht.co.uk
Mon Feb 11 14:06:03 GMT 2008
Lee Hughes wrote:
>
>
> */Gary Short <gary at garyshort.org>/* wrote:
>
> -------- Original Message --------
> > From: Lee Hughes
> > Sent: 11 February 2008 13:28
> > To: Tayside Linux User Group
> > Subject: Re: [dundee] Rails work
> >
> > Can't you just load balance with a farm? I've load balanced a few
> php apps
> > before, with success? or is there something with rails I'm missing?
> > does it support database locking for example?
>
> The trouble with Rails is that it uses the MVC pattern (Model, View
> Controller) where the interaction between the Model (an object that
> holds entity information and has business behavour) and the View
> (the web page in this case) is managed by the Controller.
>
> So, you may see a URL like http://www.MyDomain.com/customer/12/edit
> (which means edit the customer who has id = 12). However, this URL
> doesn't actually exist and Mod_rewrite is used to route the request
> to http://www.MyDomain.com/controllers/customer.rb (or similar)
> passing /customer/12/edit as a parameter so that the code in the
> controller knows what to do. This is really cool BTW, but makes load
> balancing a PITA.
>
> This is not a problem confined to Rails of course, all MVC
> frameworks (Rails, ASP.Net MVC, CakePHP etc) have this problem to
> overcome. However, Rails further suffers from Ruby's inherent poor
> performance aswell. Look out for this being fixed in the short to
> medium term though, very clever people are working on it right now.
>
> --
> Cheers,
> Gary
> http://www.garyshort.org
>
>
> Very Interesting, so, I guess the only open is to balance on source ip
> address
> of the client, and direct same request to the same server , not exactly
> dynamic
> balancing but it will work. However, sharing session state was always a
> big problem, store it in memory (of the web server) and you have a problem
> distributing that across the cluster, store it in the database and you have
> the problem of performance , you have to reread you session variables on
> every
> page load. . pick yer enemy.
>
> Keeping clients on the same server seems to do the job, but it's always
> better if a farm of servers can handle any request, ensuring the least
> loaded
> get works to do.
>
> Does rails have any caching , like mmcache?
>
> that would certainly speed things up, why recompute a web page, when
> 9 times out of 10, your serving dynamic (which does'nt change that much).
>
> It's certainly interesting stuff, from now on I'm moving from rails to
> assembler code. that should improve performance somewhat ;-)
>
It is possible to get apache to help with load balancing. Basically you configure apache to hive off
an incoming request to a mongrel instance. The server will be running several mongrel instances
(hence the term "a pack of mongrels"). Another option open to you (and I know even less about this)
is use JRuby and Glassfish v2.0. As I understand it this is supposed to have reasonable performance.
Glassfish is open source and you can get it with Netbeans 6.0 (www.netbeans.org)
HTH
Cheers
Barry
More information about the dundee
mailing list