Re: Tracking down memory hogs

2006-06-23 Thread Jay Buffington
On Thu, 2006-06-22 at 11:20 -0700, Jay Buffington wrote: I'm considering writing a PerlLogHandler that will print out the memory usage (using GTop) before and after each request so I can find the offending code path. I wrote this script and it turned out to work very well. It's small, so I inc

bug in current_callback or worse?!?!

2006-06-23 Thread john doe
So I want to register a method to be run during the cleanup phase.  After the content phase I'm in the logging phase and I do the following:$r->register_cleanup(sub { $self->process_queue(); }); Inside process_queue method I print out what phase I'm in using r->current_callback(), it "claims" I'm i

Re: (Database-)Object initialization during server-startup

2006-06-23 Thread John ORourke
Perrin Harkins wrote: Create a new instance of the mod_perl handler module during startup and refer to that for the handlers (code below). This module would then cache DB connections and provide a method for 'create or fetch current DB connection'. DBI->connect_cached will do all of this f

Re: (Database-)Object initialization during server-startup

2006-06-23 Thread Tobias Kremer
Zitat von Perrin Harkins <[EMAIL PROTECTED]>: > > Create a new instance of the mod_perl handler module during startup and > > refer to that for the handlers (code below). > > This module would then cache DB connections and provide a method for > > 'create or fetch current DB connection'. > > DBI->

Re: (Database-)Object initialization during server-startup

2006-06-23 Thread Perrin Harkins
John ORourke wrote: It does make a separate DB connection in each apache process but I think trying to share 1 DB connection between httpd's is probably going to cost more than it gains. It's not actually possible to share a connection between processes unless your database library explicitly

Re: (Database-)Object initialization during server-startup

2006-06-23 Thread John ORourke
Personally I don't use Apaceh::DBI, because I have a similar situation to you. Here's how I do it, it may not be the best way but it's fairly clean. It does make a separate DB connection in each apache process but I think trying to share 1 DB connection between httpd's is probably going to co

Re: (Database-)Object initialization during server-startup

2006-06-23 Thread Perrin Harkins
Tobias Kremer wrote: Ok, got that! But how does the class get its database handle to operate on? One of these ways: my $dbh = DBI->connect_cached(...); my $dbh = My::Database->get_dbh(); You do that every time you need one. sub new { ... $self->{_dbh} = My::Database->new()->dbh(); ... }

Re: (Database-)Object initialization during server-startup

2006-06-23 Thread Tobias Kremer
Zitat von Perrin Harkins <[EMAIL PROTECTED]>: > You need to separate managing your database connections from caching > this data. They are not related, and there's no reason to do both in > one class. Either just call connect_cached all the time (it uses > Apache::DBI when it finds it loaded), o

Re: (Database-)Object initialization during server-startup

2006-06-23 Thread Perrin Harkins
Tobias Kremer wrote: That's easy under standalone conditions (connect within new, store the dbh in $self->{_dbh} and use that in other methods). I don't recommend doing that. Better to use DBI->connect_cached in most cases. It will actually check to see if your connection is still good befo

(Database-)Object initialization during server-startup

2006-06-23 Thread Tobias Kremer
Hey guys, I'm wondering what's the best way to design a database-backed module which works completely on its own as well as within mod_perl (mp1). The module should make a database connection during object initialization (new). This connection should then be used by all methods which want to acces

different FIxupHandler in different subdirs of reverse-proxy

2006-06-23 Thread Charles Bueche
Hi, I have two fixup handlers, which I want to use in two separate directories (dir 2 being under dir 1) : ... PerlFixupHandler Apache2::mod_AAA ... ... ... https://server/BBB/> ... PerlFixupHandler Apache2::mod_BBB ... Is this allowed ? Will it