Connection pooling
Hi,
my database has to handle quickly several number of queries per second
from numerous clients.
Because of the waste of time for connection/disconnection, Im' looking
for a connection pooling tool.
Where can I find a such tool or can somebody send me one ?
Many thanks in advance,
Guillaume.
Hi,
With Apache/mod_perl it is very simple to enable DB connection
persistance.
in your perl script :
use vars qw($dbh);
$dbh ||= DBI::connect($datasrc, $dbuser, $dbpwd);
That create a persistance connection to your DB and you do not have to
care
about a pool of connection. Double pipe do all for you :-)
But if you really want a pool just create an array of this kind of global
var at startup
and switch to any indices as you want.
Don't forget to use Apache::DBI on top of DBI.pm. See mod_perl
documentation
for a complete setting.
Hope this help.
Regards,
Guillaume L�mery wrote:
Show quoted text
Hi,
my database has to handle quickly several number of queries per second
from numerous clients.
Because of the waste of time for connection/disconnection, Im' looking
for a connection pooling tool.Where can I find a such tool or can somebody send me one ?
Many thanks in advance,
Guillaume.
Quoting Guillaume L�mery <glemery@comclick.com>:
Hi,
my database has to handle quickly several number of queries per second
from numerous clients.
Because of the waste of time for connection/disconnection, Im' looking
for a connection pooling tool.Where can I find a such tool or can somebody send me one ?
What interface are you using? JDBC/ODBC/LibPQ?
Peter
Many thanks in advance,
Guillaume.
--
Peter Mount peter@retep.org.uk
PostgreSQL JDBC Driver: http://www.retep.org.uk/postgres/
RetepPDF PDF library for Java: http://www.retep.org.uk/pdf/
Gilles DAROLD writes:
With Apache/mod_perl it is very simple to enable DB connection
persistance.in your perl script :
use vars qw($dbh);
$dbh ||= DBI::connect($datasrc, $dbuser, $dbpwd);
Even better, Apache::DBI will pool across Perl programs, and you don't
have to change anything in your scripts.
On Thu, 25 Jan 2001, Gilles DAROLD wrote:
Don't forget to use Apache::DBI on top of DBI.pm. See mod_perl
documentation
for a complete setting.
Apache::DBI is supposed to be supporting connection pooling in the near
future.
-- Brett
http://www.chapelperilous.net/~bmccoy/
---------------------------------------------------------------------------
The universe seems neither benign nor hostile, merely indifferent.
-- Sagan
On Thu, Jan 25, 2001 at 01:12:48PM -0500, Brett W. McCoy wrote:
Apache::DBI is supposed to be supporting connection pooling in the near
future.
I believe this is scheduled (and only technically possible) with mod_perl
2.0, which will work with Apache 2.0 -- and they're both still in alpha.
So I wouldn't hold your breath...
But I agree -- mod_perl 2.0 will be really good, when it's released.
--
Neil Conway <neilconway@home.com>
Get my GnuPG key from: http://klamath.dyndns.org/mykey.asc
Encrypted mail welcomed
Good composers borrow. Great composers steal.
-- Igor Stravinsky
On Thu, Jan 25, 2001 at 05:14:50PM +0100, Gilles DAROLD wrote:
Hi,
With Apache/mod_perl it is very simple to enable DB connection
persistance.in your perl script :
use vars qw($dbh);
$dbh ||= DBI::connect($datasrc, $dbuser, $dbpwd);
That create a persistance connection to your DB and you do not have to
care
about a pool of connection. Double pipe do all for you :-)But if you really want a pool just create an array of this kind of global
var at startup
and switch to any indices as you want.
How's that supposed to work? Apache is a multi-process web server.
Connection pooling over all Apache children that are currently alive on
a web server would require some kind of inter-process communication,
which I don't think Apache supports (am I mistaken?).
Regards, Frank
On Thu, 25 Jan 2001, Frank Joerdens wrote:
How's that supposed to work? Apache is a multi-process web server.
Connection pooling over all Apache children that are currently alive on
a web server would require some kind of inter-process communication,
which I don't think Apache supports (am I mistaken?).
That's what Apache 2.0 is about. It will be able to run in a multi-thread
mode, or in multi-process mode with some data shared via shared memory.
-alex
On Thu, Jan 25, 2001 at 03:27:21PM -0500, Alex Pilosov wrote:
On Thu, 25 Jan 2001, Frank Joerdens wrote:
How's that supposed to work? Apache is a multi-process web server.
Connection pooling over all Apache children that are currently alive on
a web server would require some kind of inter-process communication,
which I don't think Apache supports (am I mistaken?).That's what Apache 2.0 is about. It will be able to run in a multi-thread
mode, or in multi-process mode with some data shared via shared memory.
Ah, that explains it. Very cool indeed!
Ta, Frank
Take a look to Apache::DBI
bye
valter
From: Frank Joerdens <frank@joerdens.de>
To: Gilles DAROLD <gilles@darold.net>
CC: pgsql-general <pgsql-general@postgresql.org>
Subject: Re: [GENERAL] Connection pooling
Date: Thu, 25 Jan 2001 20:57:33 +0100On Thu, Jan 25, 2001 at 05:14:50PM +0100, Gilles DAROLD wrote:
Hi,
With Apache/mod_perl it is very simple to enable DB connection
persistance.in your perl script :
use vars qw($dbh);
$dbh ||= DBI::connect($datasrc, $dbuser, $dbpwd);
That create a persistance connection to your DB and you do not have to
care
about a pool of connection. Double pipe do all for you :-)But if you really want a pool just create an array of this kind of
global
var at startup
and switch to any indices as you want.How's that supposed to work? Apache is a multi-process web server.
Connection pooling over all Apache children that are currently alive on
a web server would require some kind of inter-process communication,
which I don't think Apache supports (am I mistaken?).Regards, Frank
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
Import Notes
Resolved by subject fallback
At 1:40 AM +0100 1/26/01, Valter Mazzola wrote:
Take a look to Apache::DBI
bye
valterFrom: Frank Joerdens <frank@joerdens.de>
To: Gilles DAROLD <gilles@darold.net>
CC: pgsql-general <pgsql-general@postgresql.org>
Subject: Re: [GENERAL] Connection pooling
Date: Thu, 25 Jan 2001 20:57:33 +0100On Thu, Jan 25, 2001 at 05:14:50PM +0100, Gilles DAROLD wrote:
Hi,
With Apache/mod_perl it is very simple to enable DB connection
persistance.in your perl script :
use vars qw($dbh);
$dbh ||= DBI::connect($datasrc, $dbuser, $dbpwd);
That create a persistance connection to your DB and you do not have to
care
about a pool of connection. Double pipe do all for you :-)But if you really want a pool just create an array of this kind of global
var at startup
and switch to any indices as you want.How's that supposed to work? Apache is a multi-process web server.
Connection pooling over all Apache children that are currently alive on
a web server would require some kind of inter-process communication,
which I don't think Apache supports (am I mistaken?).
Apache::DBI provides persistent connections within each httpd child
process. It does not do connection pooling across httpd children.
Frank Joerdens wrote:
How's that supposed to work? Apache is a multi-process web server.
Connection pooling over all Apache children that are currently alive on
a web server would require some kind of inter-process communication,
which I don't think Apache supports (am I mistaken?).Regards, Frank
Of course it works, what a strange idea ? When you load a perl script with
mod_perl if you define global vars they are defined for all childrens !
Interprocess communication is an other history...
Hi,
Just to repeat that we have this stuff enabled using perl and mod_perl for a
very
long time. Just try to declare all your vars as global (without my or local)
and
see what's append between apache child process :-)
But as I know Apache::DBI doesn't do db connexion pooling, this is a
mistake.
It just allows you to create persitante connexion. But you can declare
multiple
persistante connection and do a random access to each one if your really
need
to play with that. Personnaly I never had to use that, but I think that with
a site
with a large amout of simoultaneous user it can be usefull.
Regards
Alex Pilosov wrote:
Show quoted text
On Thu, 25 Jan 2001, Frank Joerdens wrote:
How's that supposed to work? Apache is a multi-process web server.
Connection pooling over all Apache children that are currently alive on
a web server would require some kind of inter-process communication,
which I don't think Apache supports (am I mistaken?).That's what Apache 2.0 is about. It will be able to run in a multi-thread
mode, or in multi-process mode with some data shared via shared memory.-alex
At 12:39 PM +0100 1/26/01, Gilles DAROLD wrote:
Hi,
Just to repeat that we have this stuff enabled using perl and mod_perl for a
very
long time. Just try to declare all your vars as global (without my or local)
and
see what's append between apache child process :-)But as I know Apache::DBI doesn't do db connexion pooling, this is a
mistake.
It just allows you to create persitante connexion. But you can declare
multiple
persistante connection and do a random access to each one if your really
need
to play with that. Personnaly I never had to use that, but I think that with
a site
with a large amout of simoultaneous user it can be usefull.
The point is that if two child processes share a connection (which is
actually just a TCP or Unix socket) then you have two writers to the
same output channel. This is a no-no, since data corruption can
result, just as if two writers share an open filehandle for writing.
It would in theory be possible for somebody to write a connection
pool package for Apache that included proper concurrency control.
However Apache::DBI doesn't do that.
Steve L