You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Adinarayana Kadiyam <na...@mahindrabt.com> on 2002/04/22 10:36:08 UTC

Proxy Throughput Round-Robin

Hi ,
    In the Proxy Throughpult Round-Robin method for load balancing feature
available in Apache web server,  The mapping rules are like this.

RewriteEngine on
RewriteMap    lb      prg:/path/to/lb.pl
RewriteRule   ^/(.+)$ ${lb:$1}           [P,L]

Where lb.pl is some thing like this.

#!/path/to/perl
##
##  lb.pl -- load balancing script
##

$| = 1;

$name   = "www";     # the hostname base
$first  = 1;         # the first server (not 0 here, because 0 is myself) 
$last   = 5;         # the last server in the round-robin
$domain = "foo.dom"; # the domainname

$cnt = 0;
while (<STDIN>) {
    $cnt = (($cnt+1) % ($last+1-$first));
    $server = sprintf("%s%d.%s", $name, $cnt+$first, $domain);
    print "http://$server/$_";
}

##EOF##

It appends the path passed to it and constructs a new URL. 

Is there any way In which I can send the cookie information to this perl
script  as STDIN ?

Regards,
Adi.

*********************************************************
Disclaimer

This message (including any attachments) contains 
confidential information intended for a specific 
individual and purpose, and is protected by law. 
If you are not the intended recipient, you should 
delete this message and are hereby notified that 
any disclosure, copying, or distribution of this
message, or the taking of any action based on it, 
is strictly prohibited.

*********************************************************
Visit us at http://www.mahindrabt.com