Mailing List Archive

not to redirect to localhost
Hi,

I started to play with mod_backhand and found out that by default
localhost is included in the available server pool which imply that hits
will be redirected to localhost. We run mod_perl which uses tons of
memory. So I'd like to create a master mod_backhand server which does
not process any mod_perl requests at all. All mod_perl requests will be
redirected to other servers. I could use byHostname.so but regular
expression match seems to be an over-kill for my purpose. Can some one
shed some light regarding modifying mod_backhand.c so that the localhost
is excluded?

Thanks

Horace
--
Horace J. Meng
hjmeng@linkshare.com
LinkShare Corporation
646-654-6000 (T)
215 Park Ave S., 8th FL, New York, NY 10003 (at 18th St)
646-602-0160 (F)
Earn commission with 400+ merchants. Join free at
http://www.linkshare.com/join
not to redirect to localhost [ In reply to ]
"Horace J. Meng" wrote:
> I started to play with mod_backhand and found out that by default
> localhost is included in the available server pool which imply that hits
> will be redirected to localhost. We run mod_perl which uses tons of
> memory. So I'd like to create a master mod_backhand server which does
> not process any mod_perl requests at all. All mod_perl requests will be
> redirected to other servers. I could use byHostname.so but regular
> expression match seems to be an over-kill for my purpose. Can some one
> shed some light regarding modifying mod_backhand.c so that the localhost
> is excluded?

localhost? You mean the local IP of the machine NOT 127.0.0.1. This
would only happen in you have your hostname resolving to 127.0.0.1.
Ooops.

OK.. So, first off, you will need to run mod_backhand on al of the
machines (even the mod_perl ones).

It sound like you want machines like:
perl1.a.com perl2.a.com perl3.a.com AND
fe1.a.com

where perl# are mod_perl servers w/ mod_backhand
and fe# is a frontend server w/o mod_perl, but w/ mod_backhand.

Then you only advertise the IP to your fe server to the outside world.

You then wish to make sure that the fe machine doesn't consider itself.

The easiest way to do this is byHostname. IF you don't want the
overhead, you can easily write a candidacy function that will do that...
Here is one that removes oneself from the list.

I am just typing this into email.. I did not check it, but it should be
okay ;)

###### begin notMe.c ########
#include "httpd.h"
#include "http_log.h"
#include "mod_backhand.h"
int notMe(request_rec *r, int *servers, int *n, char *arg) {
int i, j;
for(i=0,j=0; i<*n; i++;j++)
if(servers[i] == 0) i++;
servers[j]=servers[i];
}
*n = j;
return j;
}
###### end notMe.c #########

Compile this the same way that byHostname.c is compiled. Happy HAcking
;)

--
Theo Schlossnagle
33131B65/2047/71 F7 95 64 49 76 5D BA 3D 90 B9 9F BE 27 24 E7