when max connections reached redirect

Discussion in 'General' started by kc8yds, Aug 13, 2009.

  1. kc8yds

    kc8yds Active Member

    say i have 3 servers
    1.media.com 2.media.com 3.media.com

    i have max connections on each of them set to 75

    once max connections is reached on 1.media how can i do a header redirect to 2.media.com ?
  2. mistwang

    mistwang LiteSpeed Staff

    It wont work that way. once the max connections reached, no more TCP connections will be accepted by LSWS, so it wont be able to send back a redirect response.

    You have to use something like DNS load balancing, or use our Load balancer in front of the web server farm.
  3. kc8yds

    kc8yds Active Member


    guess i'll go with dns round robin then

    just wish something like this was possible to make sure all servers are used to their max (round robin can easily send more traffic to one server than another)
  4. robfrew

    robfrew Well-Known Member

    That's why load balancers are nice!
  5. kc8yds

    kc8yds Active Member

    header('Content-Type: text/plain');
    preg_match('/'.preg_quote('o]: REQ_PROCESSING: ').'([0-9]{1,3})/',file_get_contents('/tmp/lshttpd/.rtreport'),$matches);
    header('Content-Length: '.strlen($matches[1]));
    echo $matches[1];

    ^ rtreport.php on video.1-5.site.com

    then site.com checks each starting at 1 with a timeout of 100 ms (will test going even lower--all servers are located on the same network) -- if it times out or if the number returned equals 90% or more it tries the next

    isn't the nicest looking solution but it works and that is all that matters

Share This Page