external application "name" for rails easy context

Discussion in 'Install/Configuration' started by fantasydreaming, Oct 20, 2006.

  1. fantasydreaming

    fantasydreaming New Member

    Hi,

    I'm struggling with defining a "manual" external lsapi definition so that I can load balance between my local lsapi and a lsws installation on my other server.

    1) Basically, the only reason I need to make a manual one is to give it a "name" so I can included it in the load balance list. Is there any name given to the rails context definition that I could just use? It seems like internally it should just emulate the standard configuration - I checked to see if it showed the expanded config in the .xml file, but no luck.

    2) Otherwise, what command do I put? The config walkthrough (which is otherwise great) still references myapp/public/dispatch.lsapi, when this has been moved into the lsws directory instead now. http://www.litespeedtech.com/support/wiki/doku.php?id=litespeed_wiki:ruby_rails

    3) How can I configure how much traffic goes to each of the load balanced servers? I'd like to have 60% on the local server, and 40% on the second one - is that possible? I don't think it's smart enough to find out how bad the load is on each machine and proxy accordingly...

    I know I could just run two lsws on my main host and load balance to the rails context that way, but I'm worried I'll need the speed and hate the idea of that much indirection.

    Thanks for a great service!

    -Kevin
  2. fantasydreaming

    fantasydreaming New Member

  3. mistwang

    mistwang LiteSpeed Staff

    Answers to you questions:

    1) If you want to load balancing, you cannot use the rails easy configuration, have to follow the step by step configuration.

    2) for the local rails install, you can use the "lsws/fcgi-bin/RailsRunner.rb", just add a environment variable "RAILS_ROOT" pointing to your Rails root context.

    3) Yes, it can be done. It is controled by "Max Conn" configuration of the two external application, for example, set "Max Conn" on local server to 60, set "Max Conn" to the secondary server to "40", web server will allocate load as you wished. You can change that value as you need, just keep it at 6:4 ratio.

    Thank you for your praise.
  4. fantasydreaming

    fantasydreaming New Member

    Thanks.

    There doesn't seem to be any way to use the $VH_ROOT variable in defining the environment variables in the LSAPI external app definition? I've tried {VH_ROOT} and things, but no luck.

    I was going to try putting my configuration in a VH template, but it wouldn't work with ENV having RAILS_ROOT hard coded. I guess I could always copy RailsRunner.rb into each project's /public directory and it would figure it out, if variables aren't allowed in ENV definitions.

    I'm starting to realize that bouncing it through an an extra virtual host before load balancing so I can use the easy rails context would have been easier and nearly as fast. But now I'm curious about this road :)
  5. mistwang

    mistwang LiteSpeed Staff

    You can copy RailsRunner.rb or dispatch.lsapi in our ruby-lsapi source code package, RailsRunner.rb needs the RAILS_ROOT env, dispatch.lsapi does not.

    It is a lot easier to use the easy rails context, load balancer via proxy via LSAPI, there are extra overheads, but should be minimum, if the main server have enough head room, it is not a bad choice.

Share This Page