[OT] Replacing reverse squid with mod_proxy

2002-03-25 Thread Hans Juergen von Lengerke

We are currently using squid set up as a reverse proxy to accelerate
several heavy backends (mod_perl, etc) and to protect them from slow
client connections.

I am looking into replacing the squid with apache+mod_proxy. Why?
Because ultimately I'd like to be able to cluster the frontend using
mod_backhand + wackamole. The primary reason for clustering isn't for
load-balancing (yet) but for failover handling. So, ideally, one machine
should be enough to serve the whole server load.

Speaking of load, the squid (2.3.STABLE1) is currently doing up to 80
requests per second at a cache hit ratio of around 72%. This is on one
box, a Dual 500MHz Pentium III with 1GB RAM. Average object size is 6KB.
200/304 ratio is around 5/3.

Now, I've tried to replace the squid with apache+mod_proxy (1.3.11) and
the frontend very quickly came to a standstill. I set MaxClients to 256
but all slots filled up fast. I upped MaxClients to 512 (recompiled with
patched httpd.h) but the result was the same. All slots were occupied in
no time and the server ground to a halt.

Now I'm left with two choices: give up or try harder :-)

Before I decide for one of them I thought I'd ask on the lists (sorry
for the x-post) to see if the above numbers (80 Hits/Second) are in fact
feasible with apache/mod_proxy on one box. Are there any benchmarks
around? Does someone have a similar setup and how many requests can they
serve?  Should I up MaxClients any further? Will I get better results
using a newer version of apache? Or should I give up and stick with
squid?

TIA for your input.




Re: Be carefull with apache 1.3.24

2002-03-25 Thread Hans Juergen von Lengerke

John Siracusa [EMAIL PROTECTED] on Mar 25, 2002:

 Does anyone know how I can put my ProxyIOBufferSize config line in a
 conditional that'll keep it from blowing up if I'm using a version
 of apache earlier than 1.3.24?

You could use IfDefine but that would mean that the command that
starts apache needs to be aware of which version you are using and
modifying startup params accordingly.

See http://httpd.apache.org/docs/mod/core.html#ifdefine




Re: problems with $r-status('OK')

2002-03-04 Thread Hans Juergen von Lengerke

clayton cottingham [EMAIL PROTECTED] on Mar 4, 2002:

 every time i use
 the $r-status('OK');

OK in this context is not a string, but a constant that is defined in
Apache::Constants. Modify your code like this:

  use Apache::Constants qw(:common);
  ...
  $r-status(OK);   # No quotes, it's a constant


HTH, Hans




Re: [OT-ish] Session refresh philosophy

2002-02-20 Thread Hans Juergen von Lengerke

David Harris [EMAIL PROTECTED] on Feb 19, 2002:

 The encoded information is [...] split into reasonable length hidden
 fields.

Why not put everything in one field? Are there restrictions? Does it
make a difference when using POST?

Hans




Re: PerlPassEnv and Proxies

2002-02-18 Thread Hans Juergen von Lengerke

Andrew Green [EMAIL PROTECTED] on Feb 18, 2002:

 As part of this, I'm trying to allow a prefix to the URL path to set an
 environment variable I can then use in my mod_perl programs to determine
 databases, templates etc.

 The vanilla httpd.conf features a line thus:

RewriteRule ^/(test|access|ewok)/(.*)$
http://spare.article7.co.uk:8080/page/$2 [P,E=A7_FRAMEWORK:$1,L]

 (ignoring the wrapping).  I also set PerlPassEnv A7_FRAMEWORK in my
 mod_perl httpd.conf -- but that environment variable always remains
 undef. The order of the P,E,L flags doesn't seem to make a difference.

As others pointed out, you cannot set envivonment variables in the
vanilla and expect them to appear out of nothing in the mod_perl server.

I have had a similar Problem and got by it like this. You can have two
RewriteRules, one in the vanilla and a corresponding in the mod_perl:

vanilla:
   RewriteRule ^/(test|access|ewok)/(.*)$
   http://spare.article7.co.uk:8080/ENV_A7_FRAMEWORK/$1/page/$2
   [P,E=A7_FRAMEWORK:$1,L]

or, if you don't need A7_FRAMEWORK in the vanilla you can omit it here:
   RewriteRule ^/(test|access|ewok)/(.*)$
   http://spare.article7.co.uk:8080/ENV_A7_FRAMEWORK/$1/page/$2
   [P,L]

mod_perl:
   RewriteRule ^/ENV_([^/]+)/([^/]+)/(.*)$ $3 [E=$1:$2,PT,L]

I agree, its a big hack, but it works :-)

HTH, Hans




Re: mod_perl compile problem

2002-02-14 Thread Hans Juergen von Lengerke

OCNS Consulting [EMAIL PROTECTED] on Feb 14, 2002:

 [mod_perl-1.26]# perl Makefile.PL APACHE_SRC=/dist/apache_1.3.23/src
 DO_HTTPD=1 USE_ACAPI=1 PREP_HTTPD=1 EVERYTHING=1
 ^
Make that USE_APACI=1

Now, I may be missing something and somebody already asked you earlier
about this: You are using ActiveState Perl on Linux? I always thought
ActiveState Perl is for Windows boxen. No?

Hans




Persistent HTTP Connections ala Apache::DBI

2001-11-22 Thread Hans Juergen von Lengerke

I'm working on a web application which obtains data via a legacy system
rather than DBI. Using DBI is (unfortunately) not an option. The machine
where the web application runs cannot run the legacy system. Thus, the
setup looks somewhat like this:

   DB  =  DB Query (Legacy)  =  Apache/mod_perl  =  Client

I was thinking to make the connection between DB Query and
Apache/mod_perl using HTTP, so there will be an Apache running on the DB
Query tier for access to the legacy system.

What I'm interested in, is a persistent HTTP connection between the
Apache/mod_perl tier and the DB Query tier. I'm thinking of a ChildInit
handler which opens up a HTTP/1.1 connection to the apache sitting on
the DB query tier. The connection would use keep-alive, which of course
would be enabled and set to high timeout values on the DB Legacy tier.

This is more or less what Apache::DBI does, just in this case it should
be something like Apache::PersistentHTTPConnection. Unfortunately, I
haven't found such a thing.

Has anyone done such a thing before? Can someone point me to docs or
modules which could help doing this? Or is this whole idea maybe just
plain stupid? Are there obvious caveats I haven't thought of?

Any comments are welcome.




Apache::DBI Segmentation fault

2001-09-10 Thread Hans Juergen von Lengerke

I am getting a segmentation fault on configtest when using Apache::DBI
(using the startup.pl example in Apache::DBI Distribution). When trying
to start the server I get no error messages but the server isn't
running afterwards:

 root@ganja:/home/www/server/conf  ../bin/apachectl start
 ../bin/apachectl start: httpd started
 root@ganja:/home/www/server/conf  ps -ef | grep httpd
 lengerke  5787 27877  0 12:11 pts/500:00:00 vi httpd.conf
 root  6434  5760  0 12:57 pts/11   00:00:00 grep httpd
 root@ganja:/home/www/server/conf  ../bin/apachectl configtest
 Syntax OK
 ../bin/apachectl: line 184:  6436 Segmentation fault  $HTTPD -t
 root@ganja:/home/www/server/conf 

When I comment out the 'use Apache::DBI' in startup.pl all works fine.
Setting $Apache::DBI::DEBUG = 2 makes no difference even in verbosity of
the error_log - the server will die without any warning or error.

The setup is:
SuSE Linux 6.3 (i386)

Apache/1.3.20 (Unix)   # (enabled proxy, rewrite, so, ssl)
PHP/4.0.6  # apxs-built DSO
mod_perl/1.26  # apxs-built DSO
mod_jk # apxs-built DSO
mod_ssl/2.8.4
OpenSSL/0.9.4

Perl 5.005_03

Apache::DBI 0.88
DBI 1.14   # works fine without Apache::DBI

Any help or pointers are appreciated.

Hans




Re: Apache::DBI Segmentation fault

2001-09-10 Thread Hans Juergen von Lengerke

Uh, sorry forgot to post Database and perl -V...

Database is Informix.

Summary of my perl5 (5.0 patchlevel 5 subversion 3) configuration:
  Platform:
osname=linux, osvers=2.2.13, archname=i586-linux
uname='linux benjy 2.2.13 #4 mon aug 16 11:18:11 mest 1999 i686
unknown '
hint=recommended, useposix=true, d_sigaction=define
usethreads=undef useperlio=undef d_sfio=undef
  Compiler:
cc='cc', optimize='-O2 -pipe', gccversion=egcs-2.91.66
19990314/Linux (egcs-1.1.2 release)
cppflags='-Dbool=char -DHAS_BOOL -I/usr/local/include'
ccflags ='-Dbool=char -DHAS_BOOL -I/usr/local/include'
stdchar='char', d_stdstdio=undef, usevfork=false
intsize=4, longsize=4, ptrsize=4, doublesize=8
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
alignbytes=4, usemymalloc=n, prototype=define
  Linker and Libraries:
ld='cc', ldflags =' -L/usr/local/lib'
libpth=/usr/local/lib /lib /usr/lib
libs=-lnsl -lndbm -lgdbm -ldb -ldl -lm -lc -lposix -lcrypt
libc=, so=so, useshrplib=false, libperl=libperl.a
  Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'


Characteristics of this binary (from libperl): 
  Built under linux
  Compiled at Nov  6 1999 15:47:59
  @INC:
/usr/lib/perl5/5.00503/i586-linux
/usr/lib/perl5/5.00503
/usr/lib/perl5/site_perl/5.005/i586-linux
/usr/lib/perl5/site_perl/5.005
.


Hans Juergen von Lengerke:

 I am getting a segmentation fault on configtest when using Apache::DBI
 (using the startup.pl example in Apache::DBI Distribution). When trying
 to start the server I get no error messages but the server isn't
 running afterwards:
 
  root@ganja:/home/www/server/conf  ../bin/apachectl start
  ../bin/apachectl start: httpd started
  root@ganja:/home/www/server/conf  ps -ef | grep httpd
  lengerke  5787 27877  0 12:11 pts/500:00:00 vi httpd.conf
  root  6434  5760  0 12:57 pts/11   00:00:00 grep httpd
  root@ganja:/home/www/server/conf  ../bin/apachectl configtest
  Syntax OK
  ../bin/apachectl: line 184:  6436 Segmentation fault  $HTTPD -t
  root@ganja:/home/www/server/conf 
 
 When I comment out the 'use Apache::DBI' in startup.pl all works fine.
 Setting $Apache::DBI::DEBUG = 2 makes no difference even in verbosity of
 the error_log - the server will die without any warning or error.
 
 The setup is:
   SuSE Linux 6.3 (i386)
 
   Apache/1.3.20 (Unix)   # (enabled proxy, rewrite, so, ssl)
   PHP/4.0.6  # apxs-built DSO
   mod_perl/1.26  # apxs-built DSO
   mod_jk # apxs-built DSO
   mod_ssl/2.8.4
   OpenSSL/0.9.4
 
   Perl 5.005_03
 
   Apache::DBI 0.88
   DBI 1.14   # works fine without Apache::DBI
 
 Any help or pointers are appreciated.
 
 Hans
 




Re: Apache::DBI Segmentation fault

2001-09-10 Thread Hans Juergen von Lengerke

Hi,

I actually got this to work now. The segfault happens when I load
Apache::Registry before Apache::DBI. However, I have used the
eg/startup.pl from the Apache::DBI distribution and that has
Apache::Registry loaded before Apache::DBI... Maybe this is a bug?

My httpd.conf Perl* relevant parts:
  LoadModule perl_module libexec/libperl.so
  [...]
  PerlRequire /home/www/server/conf/startup.pl
  PerlFreshRestart on
  [...]
  PerlModule Apache::Registry
  DirectoryMatch /home/www/hosts/[^/]*/cgi-perl
  Options FollowSymLinks ExecCGI
  SetHandler perl-script
  PerlHandler Apache::Registry
  PerlSendHeader On
  AllowOverride None
  Order allow,deny
  Allow from all
  /DirectoryMatch
  [...]
  Location /perl-status
  SetHandler perl-script
  PerlSetVar StatusOptionsAll On
  PerlHandler Apache::Status
  /Location

and the (fixed) startup.pl:
  #!/usr/local/bin/perl -w
  $ENV{GATEWAY_INTERFACE} =~ /^CGI-Perl/ or die GATEWAY_INTERFACE not Perl!;
  use Apache::DBI;
  use Apache::Registry;
  use strict;
  $Apache::DBI::DEBUG = 2;

Now if Apache::Registry is loaded before Apache::DBI in startup.pl I get
the segfault. Also, If I don't use startup.pl and put a 'PerlModule
Apache::DBI' _after_ the 'PerlModule Apache::Registry' in my httpd.conf
I also get the segfault. I am aware that any modules that use DBI must
be loaded _after_ Apache::DBI but I didn't think Apache::Registry uses
DBI, or does it?

Hans


Perrin Harkins:

  I am getting a segmentation fault on configtest when using Apache::DBI
  (using the startup.pl example in Apache::DBI Distribution). When trying
  to start the server I get no error messages but the server isn't
  running afterwards
 
 Do you know that your DBI works without Apache::DBI?  It would be helpful if
 you could post the relevant parts of your httpd.conf and startup.pl too.
 - Perrin