in reply to Database Connection Pooling: Take 2

Please read this. It's a good answer to a FAQ on the mod_perl list.
  • Comment on Re: Database Connection Pooling: Take 2

Replies are listed 'Best First'.
Re: Re: Database Connection Pooling: Take 2
by iguanodon (Priest) on Mar 11, 2003 at 01:44 UTC
    Very interesting. I always accepted it as Conventional Wisdom that connection pooling was the 'right' thing to do, because making connections is 'expensive'. I have to confess to some cargo cult belief here because I've always just accepted this without understanding it. Is it your opinion then that the overhead of connection pooling is as expensive or more expensive than making new connections?

      Making new connections is expensive, but connection pooling is not the only alternative. The Apache::DBI module keeps connections open so that you don't need to re-connect. It is not "pooling" because the connections are not shared -- each process opens a connection and keeps it open.

      This will change with the thread support in mod_perl 2 and a future release of DBI which will include direct support for connection pooling. In the meantime, what Apache::DBI does is fine for most sites.

      The reason I've used connection pooling is when the total number of clients is potentially very large (5-10 thousand or more). Maintaining a very large number of connections on the database server generates quite a bit of overhead. If these connections aren't active all the time then pooling them can make sense.

      Michael