Trying to use litespeed load balancer for balancing lsapi

Discussion in 'Ruby/Rails' started by technix, Jul 6, 2007.

  1. technix

    technix New Member


    I was evaluating various combinations of litespeed server and as it seems our setup is going to be more than one node/machine/server setup, using litespeed+rubylsapi is not a good idea, because we won't be able to cluster across machines.

    I did some benchmarking and found, litespeed+lsapi is sligtly faster than mongrel+nginx. However more interesting comibation that appears is to use Litespeed load balancer to balance rails lsapi instances. Litespeed balancer doesn't perform all that good with web server load balancing, but I simply couldn't make lsapi load balancing work.

    basically what I did was, installed litespeed webserver and created rails context and two listeners listening to same vhost on same port, but different IP address.

    Now in Litespeed load balancer configuration, I tried creating a LSAPI cluster and pass those IP/Ports as backend server address, but I am constantly getting a 503 errros.

    Application is a simple hello world thing, and I can hit the app directly very much.

    Also I was wondering, if anyone has tried using Litespeed load balancer with mongrels and if it performs better than nginx?

    I know that Litespeed load balancer is new, but it would be really nice to have capability of load balancing various ruby-lsapi across various nodes.
  2. mistwang

    mistwang LiteSpeed Staff

    For a cluster setup, we still recommend running LiteSpeed + rubylsapi on each backend node, because LSWS can manage the ruby process very well and be able serve static content or page cache really fast.

    You can try LSLB + ruby lsapi setup, you need to create dispatch.lsapi for the rails application, it is in our ruby-lsapi package, please checkout our Non-easy setup. ;)
    Then you can use a fastCGI spawner to start dispatch.lsapi on each node with proper environment variables set, LSLB just talk to the backend LSAPI application directly, instead of talking to LSWS. Got one less layer at the backend, but you lose ability of serving static content and you need to monitor those dispatch.lsapi processes yourself.

    Above two setup should be able to beat any mongrel based solution.
  3. technix

    technix New Member

    Ok, but if we run lsws and rubylsapi on each node, then how do we decide which node will serve request, assuming we dont have a hardware balancer and stuff.

    In otherwords, if each node is running its own pair of lsws and lsapi processes then how do we manage them.
  4. mistwang

    mistwang LiteSpeed Staff

    You still need a load balancer in front proxying requests to backend nodes. Just like what you would do with a mongrel_cluster.

Share This Page