Mailing List Archive

double startup ?
Hello,

I am, at present, testing mod_backhand for Load Balancing.

I have written something like a "mod_perl servlet" and its behaviour has changed since I have installed mod_backhand : it seems like ih all the HTTP request were executed twice.

I think that this problem is due to the fact that mod_backhand is started twice as shown in the logs/error_log of Apache :

[Wed May 5 15:03:53 2004] [info] mod_unique_id: using ip addr 127.0.0.1
[Wed May 5 15:03:53 2004] [info] created shared memory segment #1277963
[Wed May 5 15:03:53 2004] [notice] mod_backhand -- UnixSocketDir set to /home/apache/backhand
[Wed May 5 15:03:53 2004] [notice] mod_backhand -- Broadcast 127.0.0.1:4445 added
[Wed May 5 15:03:53 2004] [notice] mod_backhand -- Multicast accept 127.0.0.0/24
[Wed May 5 15:03:54 2004] [notice] backhand_init(19628) spawning moderator (PID 19641)
[Wed May 5 15:03:54 2004] [notice] mod_backhand moderator ready to go
[Wed May 5 15:03:54 2004] [info] mod_unique_id: using ip addr 127.0.0.1
[Wed May 5 15:03:55 2004] [info] created shared memory segment #1310732
[Wed May 5 15:03:55 2004] [notice] mod_backhand -- UnixSocketDir set to /home/apache/backhand
[Wed May 5 15:03:55 2004] [notice] mod_backhand -- Broadcast 127.0.0.1:4445 added
[Wed May 5 15:03:55 2004] [notice] mod_backhand -- Multicast accept 127.0.0.0/24
[Wed May 5 15:03:55 2004] [notice] backhand_init(19642) spawning moderator (PID 19643)
[Wed May 5 15:03:55 2004] [notice] mod_backhand moderator ready to go
[Wed May 5 15:03:55 2004] [info] created shared memory segment #1343501
[Wed May 5 15:03:55 2004] [notice] Apache/1.3.29 (Unix) mod_perl/1.29 mod_backhand/1.2.2 configured -- resuming normal operations
[Wed May 5 15:03:55 2004] [info] Server built: May 5 2004 15:00:55
[Wed May 5 15:03:55 2004] [notice] Accept mutex: sysvsem (Default: sysvsem)


I am running Linux Fedora Core 1, this is my compilation/installation od mod_backhand/Apache :


# cd /tmp
# tar xvzf apache_1.3.29.tar.gz
# tar xvzf mod_backhand-1.2.2.tar.gz
# tar xvzf mod_perl-1.0-current.tar.gz
# cd mod_perl-1.29/
# perl Makefile.PL APACHE_SRC=../apache-1.3.29/src PREP_HTTPD=1 DO_HTTPD=1 USE_APACI=1 EVERYTHING=1
# make
# make install
# cd ../mod_backhand-1.2.2/
# ./precompile ../apache_1.3.29/
# cd ../apache_1.3.29/
# ./configure --prefix=/home/apache/ --enable-module=so \
> --enable-module=rewrite --enable-shared=rewrite \
> --enable-module=status --enable-shared=status \
> --enable-module=backhand --enable-shared=backhand \
> --enable-module=unique_id --activate-module=src/modules/perl/libperl.a
# make
# make install


And my httpd.conf :

<Directory /usr/local/Bus_data/>
AllowOverride None
Options None
Order allow,deny
Allow from all
Backhand byAge 6
Backhand byRandom
Backhand byLogWindow
Backhand byCPU
</Directory>

<IfModule mod_backhand.c>
UnixSocketDir /home/apache/backhand
MulticastStats 127.0.0.1:4445
AcceptStats 127.0.0.0/24

<Location "/backhand/">
SetHandler backhand-handler
</Location>
</IfModule>


Do you have any ideas ?

Thank you by advance


Aymeric Masson
double startup ? [ In reply to ]
. TELAMON wrote:

>Hello,
>
>I am, at present, testing mod_backhand for Load Balancing.
>
>I have written something like a "mod_perl servlet" and its behaviour has changed since I have installed mod_backhand : it seems like ih all the HTTP request were executed twice.
>
>I think that this problem is due to the fact that mod_backhand is started twice as shown in the logs/error_log of Apache :
>
>
Likely not.

><IfModule mod_backhand.c>
> UnixSocketDir /home/apache/backhand
> MulticastStats 127.0.0.1:4445
> AcceptStats 127.0.0.0/24
>
>
Balancing on localhost? What is it that you hope to accomplish? I'll
assume your just testing things.

>Do you have any ideas ?
>
>
Yes. mod_perl hooks directly into the Apache module hook API. Module
hooks get called during every phase of the request _AND_ all sub
requests. mod_backhand makes a benign subrequest to determine how
Apache would have treated the request (transforms, etc) then makes a
balancing decision. If you have any hooks other than "handler", they
could get called more than once (this isn't only induced by
mod_backhand, other modules do this too). If you are only using
"handler", I think it is still possible, but I'd have to look into it more.

$r->is_initial_req should give you some insight as to whether this is
the "initial" Apache::Request for this HTTP request or not.

--
// Theo Schlossnagle
// Principal Engineer -- http://www.omniti.com/~jesus/
// Postal Engine -- http://www.postalengine.com/
// Ecelerity: fastest MTA on Earth
double startup ? [ In reply to ]
Thank your for your fast answer

1) Yes, I'm balancing on my localhost just for tests

2) I'm just using "handler" in my hook module. Indeed, $r->is_initial_req g=
ave me some informations : the initial HTTP requests are not any more "init=
ial" whith mod_backhand. In fact, I use this information in order to set Se=
ssion Id when the client asks the Web Application for the first time. So I =
try to rewrite my hook module but the double call is still here : a first s=
ession id is created but not used, then a second session id is created and =
used (unused means here that $r->header_out(Location =3D> + return HTTP_MOV=
ED_TEMPORARILY() is not effective)


It is likely because my "mod_perl servlet" is not compatible with mod_backh=
and (maybe because of the strange way I manage session : I rewrite the init=
ial URL http://www.foo.com/my_page in http://www.foo.com/id_session/my_page=
and I'm using Apache::Session::File or Apache::Session::Oracle). It's a pi=
ty because mod_backhand is exactly what I need.

Any help, of course, is much appreciated


Aymeric Masson



> Message du 05/05/04 15:17
> De : "Theo Schlossnagle" <jesus@omniti.com>
> A : backhand-users@lists.backhand.org
> Copie =E0 :=20
> Objet : Re: [m_b_users] double startup ?
>=20
> . TELAMON wrote:
>=20
> >Hello,
> >
> >I am, at present, testing mod_backhand for Load Balancing.
> >
> >I have written something like a "mod_perl servlet" and its behaviour h=
as changed since I have installed mod_backhand : it seems like ih all the H=
TTP request were executed twice.
> >
> >I think that this problem is due to the fact that mod_backhand is starte=
d twice as shown in the logs/error_log of Apache :
> > =20
> >
> Likely not.
>=20
> ><IfModule mod_backhand.c>
> > UnixSocketDir /home/apache/backhand
> > MulticastStats 127.0.0.1:4445
> > AcceptStats 127.0.0.0/24
> > =20
> >
> Balancing on localhost? What is it that you hope to accomplish? I'll=20
> assume your just testing things.
>=20
> >Do you have any ideas ?
> > =20
> >
> Yes. mod_perl hooks directly into the Apache module hook API. Module=20
> hooks get called during every phase of the request _AND_ all sub=20
> requests. mod_backhand makes a benign subrequest to determine how=20
> Apache would have treated the request (transforms, etc) then makes a=20
> balancing decision. If you have any hooks other than "handler", they=20
> could get called more than once (this isn't only induced by=20
> mod_backhand, other modules do this too). If you are only using=20
> "handler", I think it is still possible, but I'd have to look into it mor=
e.
>=20
> $r->is_initial_req should give you some insight as to whether this is=20
> the "initial" Apache::Request for this HTTP request or not.
>=20
> --=20
> // Theo Schlossnagle
> // Principal Engineer -- http://www.omniti.com/~jesus/
> // Postal Engine -- http://www.postalengine.com/
> // Ecelerity: fastest MTA on Earth
>=20