Обсуждение: postgres and persistant connections (using Apache::DBI)

Поиск
Список
Период
Сортировка

postgres and persistant connections (using Apache::DBI)

От
"Salem Berhanu"
Дата:
I am trying to set up a persistent connection to a handful of postgres dbs
at startup using Apache::DBI (also using mod_perl)
Here is what I am doing but I am not sure how to check if it's working
right.

in httpd.conf I have
PerlRequire startup.pl

in startup.pl I load all the necessary perl modules and also include the
lines

use Apache::DBI;
Apache::DBI->connect_on_init( host, login, password);

This doesn�t seem to make any difference. I was expecting to see database
connections when I restarted apache and that all queries would get handled
by these connections. Is this a wrong assumption? What is the expectation
and what would be a good test when setting up persistent connections to a
postgres db?
Thanks much
Salem



Re: postgres and persistant connections (using Apache::DBI)

От
"Rajesh Kumar Mallah"
Дата:
On 3/29/06, Salem Berhanu <salemb4@hotmail.com> wrote:
> I am trying to set up a persistent connection to a handful of postgres dbs
> at startup using Apache::DBI (also using mod_perl)
> Here is what I am doing but I am not sure how to check if it's working
> right.
>
> in httpd.conf I have
> PerlRequire startup.pl
>
> in startup.pl I load all the necessary perl modules and also include the
> lines
>
> use Apache::DBI;
> Apache::DBI->connect_on_init( host, login, password);
>
> This doesn't seem to make any difference. I was expecting to see database
> connections when I restarted apache and that all queries would get handled
> by these connections. Is this a wrong assumption? What is the expectation
> and what would be a good test when setting up persistent connections to a
> postgres db?

We use DBI connection pooling with postgres in mod_perl environment
and it works fine. We however do not use connect_on_init as Apache::DBI
docs say that all DBI->connect() anyway gets intercepted transparently.

please take care that

1. Make sure Apache::DBI is loaded before any module that issues a DB connect.
you can even load Apache::DBI from httpd.conf by
PerlRequire Apache::DBI

2. You can know if Apache::DBI is effective or not by installing Apache::Status
,load Apache::Status before Apache::DBI in that case and add a Location
section in the httpd.conf like:


--------------- httpd.conf---------------------
PerlModule Apache::Status
PerlModule Apache::DBI

<Location /perl-status>
        SetHandler  perl-script
        PerlHandler Apache::Status
</Location>
------------------------------------------------------
point your browser to http://your_mod_perl_server/perl-status
and check the section about database conenctions.

i am not sure if this info answers your question but
i am describing something that works for me.

regds
Rajesh Kumar Mallah.










> Thanks much
> Salem
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: Don't 'kill -9' the postmaster
>

Re: postgres and persistant connections (using Apache::DBI)

От
"Salem Berhanu"
Дата:
Rajesh,
Thanks for the suggestion. I tried what you told me. In my startup script I
did
use Apache2::Status;
use Apache::DBI;
before any modules that use DB connect were loaded.
I also included the handler for perl-status in the conf file as you
mentioned.
However as I access different pages the database connection doesn't persist.
I check netstat on the db server and I see connections from the web server
that appear and disappear.
I checked http://my_mod_perl_server/perl-status and it has a link that says
DBI connections but with no data in it.
Also I wasn't clear on why you are not using connect_on_init.
Thanks
Salem


>From: "Rajesh Kumar Mallah" <mallah.rajesh@gmail.com>
>To: "Salem Berhanu" <salemb4@hotmail.com>
>CC: pgsql-admin@postgresql.org
>Subject: Re: [ADMIN] postgres and persistant connections (using
>Apache::DBI)
>Date: Wed, 29 Mar 2006 21:32:47 +0530
>
>On 3/29/06, Salem Berhanu <salemb4@hotmail.com> wrote:
> > I am trying to set up a persistent connection to a handful of postgres
>dbs
> > at startup using Apache::DBI (also using mod_perl)
> > Here is what I am doing but I am not sure how to check if it's working
> > right.
> >
> > in httpd.conf I have
> > PerlRequire startup.pl
> >
> > in startup.pl I load all the necessary perl modules and also include the
> > lines
> >
> > use Apache::DBI;
> > Apache::DBI->connect_on_init( host, login, password);
> >
> > This doesn't seem to make any difference. I was expecting to see
>database
> > connections when I restarted apache and that all queries would get
>handled
> > by these connections. Is this a wrong assumption? What is the
>expectation
> > and what would be a good test when setting up persistent connections to
>a
> > postgres db?
>
>We use DBI connection pooling with postgres in mod_perl environment
>and it works fine. We however do not use connect_on_init as Apache::DBI
>docs say that all DBI->connect() anyway gets intercepted transparently.
>
>please take care that
>
>1. Make sure Apache::DBI is loaded before any module that issues a DB
>connect.
>you can even load Apache::DBI from httpd.conf by
>PerlRequire Apache::DBI
>
>2. You can know if Apache::DBI is effective or not by installing
>Apache::Status
>,load Apache::Status before Apache::DBI in that case and add a Location
>section in the httpd.conf like:
>
>
>--------------- httpd.conf---------------------
>PerlModule Apache::Status
>PerlModule Apache::DBI
>
><Location /perl-status>
>         SetHandler  perl-script
>         PerlHandler Apache::Status
></Location>
>------------------------------------------------------
>point your browser to http://your_mod_perl_server/perl-status
>and check the section about database conenctions.
>
>i am not sure if this info answers your question but
>i am describing something that works for me.
>
>regds
>Rajesh Kumar Mallah.
>
>
>
>
>
>
>
>
>
>
> > Thanks much
> > Salem
> >
> >
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 2: Don't 'kill -9' the postmaster
> >



Re: postgres and persistant connections (using Apache::DBI)

От
"Rajesh Kumar Mallah"
Дата:
since it is not a postgresql issue
i think we should not discuss it over here.
i may persue it on pvt emails.

regds
mallah.

On 3/30/06, Salem Berhanu <salemb4@hotmail.com> wrote:
> Rajesh,
> Thanks for the suggestion. I tried what you told me. In my startup script I
> did
> use Apache2::Status;
> use Apache::DBI;
> before any modules that use DB connect were loaded.
> I also included the handler for perl-status in the conf file as you
> mentioned.
> However as I access different pages the database connection doesn't persist.
> I check netstat on the db server and I see connections from the web server
> that appear and disappear.
> I checked http://my_mod_perl_server/perl-status and it has a link that says
> DBI connections but with no data in it.
> Also I wasn't clear on why you are not using connect_on_init.
> Thanks
> Salem
>
>
> >From: "Rajesh Kumar Mallah" <mallah.rajesh@gmail.com>
> >To: "Salem Berhanu" <salemb4@hotmail.com>
> >CC: pgsql-admin@postgresql.org
> >Subject: Re: [ADMIN] postgres and persistant connections (using
> >Apache::DBI)
> >Date: Wed, 29 Mar 2006 21:32:47 +0530
> >
> >On 3/29/06, Salem Berhanu <salemb4@hotmail.com> wrote:
> > > I am trying to set up a persistent connection to a handful of postgres
> >dbs
> > > at startup using Apache::DBI (also using mod_perl)
> > > Here is what I am doing but I am not sure how to check if it's working
> > > right.
> > >
> > > in httpd.conf I have
> > > PerlRequire startup.pl
> > >
> > > in startup.pl I load all the necessary perl modules and also include the
> > > lines
> > >
> > > use Apache::DBI;
> > > Apache::DBI->connect_on_init( host, login, password);
> > >
> > > This doesn't seem to make any difference. I was expecting to see
> >database
> > > connections when I restarted apache and that all queries would get
> >handled
> > > by these connections. Is this a wrong assumption? What is the
> >expectation
> > > and what would be a good test when setting up persistent connections to
> >a
> > > postgres db?
> >
> >We use DBI connection pooling with postgres in mod_perl environment
> >and it works fine. We however do not use connect_on_init as Apache::DBI
> >docs say that all DBI->connect() anyway gets intercepted transparently.
> >
> >please take care that
> >
> >1. Make sure Apache::DBI is loaded before any module that issues a DB
> >connect.
> >you can even load Apache::DBI from httpd.conf by
> >PerlRequire Apache::DBI
> >
> >2. You can know if Apache::DBI is effective or not by installing
> >Apache::Status
> >,load Apache::Status before Apache::DBI in that case and add a Location
> >section in the httpd.conf like:
> >
> >
> >--------------- httpd.conf---------------------
> >PerlModule Apache::Status
> >PerlModule Apache::DBI
> >
> ><Location /perl-status>
> >         SetHandler  perl-script
> >         PerlHandler Apache::Status
> ></Location>
> >------------------------------------------------------
> >point your browser to http://your_mod_perl_server/perl-status
> >and check the section about database conenctions.
> >
> >i am not sure if this info answers your question but
> >i am describing something that works for me.
> >
> >regds
> >Rajesh Kumar Mallah.
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > > Thanks much
> > > Salem
> > >
> > >
> > >
> > > ---------------------------(end of broadcast)---------------------------
> > > TIP 2: Don't 'kill -9' the postmaster
> > >
>
>
>

Re: postgres and persistant connections (using Apache::DBI)

От
"Salem Berhanu"
Дата:
Thanks anyways


>From: "Rajesh Kumar Mallah" <mallah.rajesh@gmail.com>
>To: "Salem Berhanu" <salemb4@hotmail.com>
>CC: pgsql-admin@postgresql.org
>Subject: Re: [ADMIN] postgres and persistant connections (using
>Apache::DBI)
>Date: Thu, 30 Mar 2006 09:29:35 +0530
>
>since it is not a postgresql issue
>i think we should not discuss it over here.
>i may persue it on pvt emails.
>
>regds
>mallah.
>
>On 3/30/06, Salem Berhanu <salemb4@hotmail.com> wrote:
> > Rajesh,
> > Thanks for the suggestion. I tried what you told me. In my startup
>script I
> > did
> > use Apache2::Status;
> > use Apache::DBI;
> > before any modules that use DB connect were loaded.
> > I also included the handler for perl-status in the conf file as you
> > mentioned.
> > However as I access different pages the database connection doesn't
>persist.
> > I check netstat on the db server and I see connections from the web
>server
> > that appear and disappear.
> > I checked http://my_mod_perl_server/perl-status and it has a link that
>says
> > DBI connections but with no data in it.
> > Also I wasn't clear on why you are not using connect_on_init.
> > Thanks
> > Salem
> >
> >
> > >From: "Rajesh Kumar Mallah" <mallah.rajesh@gmail.com>
> > >To: "Salem Berhanu" <salemb4@hotmail.com>
> > >CC: pgsql-admin@postgresql.org
> > >Subject: Re: [ADMIN] postgres and persistant connections (using
> > >Apache::DBI)
> > >Date: Wed, 29 Mar 2006 21:32:47 +0530
> > >
> > >On 3/29/06, Salem Berhanu <salemb4@hotmail.com> wrote:
> > > > I am trying to set up a persistent connection to a handful of
>postgres
> > >dbs
> > > > at startup using Apache::DBI (also using mod_perl)
> > > > Here is what I am doing but I am not sure how to check if it's
>working
> > > > right.
> > > >
> > > > in httpd.conf I have
> > > > PerlRequire startup.pl
> > > >
> > > > in startup.pl I load all the necessary perl modules and also include
>the
> > > > lines
> > > >
> > > > use Apache::DBI;
> > > > Apache::DBI->connect_on_init( host, login, password);
> > > >
> > > > This doesn't seem to make any difference. I was expecting to see
> > >database
> > > > connections when I restarted apache and that all queries would get
> > >handled
> > > > by these connections. Is this a wrong assumption? What is the
> > >expectation
> > > > and what would be a good test when setting up persistent connections
>to
> > >a
> > > > postgres db?
> > >
> > >We use DBI connection pooling with postgres in mod_perl environment
> > >and it works fine. We however do not use connect_on_init as Apache::DBI
> > >docs say that all DBI->connect() anyway gets intercepted transparently.
> > >
> > >please take care that
> > >
> > >1. Make sure Apache::DBI is loaded before any module that issues a DB
> > >connect.
> > >you can even load Apache::DBI from httpd.conf by
> > >PerlRequire Apache::DBI
> > >
> > >2. You can know if Apache::DBI is effective or not by installing
> > >Apache::Status
> > >,load Apache::Status before Apache::DBI in that case and add a Location
> > >section in the httpd.conf like:
> > >
> > >
> > >--------------- httpd.conf---------------------
> > >PerlModule Apache::Status
> > >PerlModule Apache::DBI
> > >
> > ><Location /perl-status>
> > >         SetHandler  perl-script
> > >         PerlHandler Apache::Status
> > ></Location>
> > >------------------------------------------------------
> > >point your browser to http://your_mod_perl_server/perl-status
> > >and check the section about database conenctions.
> > >
> > >i am not sure if this info answers your question but
> > >i am describing something that works for me.
> > >
> > >regds
> > >Rajesh Kumar Mallah.
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > > Thanks much
> > > > Salem
> > > >
> > > >
> > > >
> > > > ---------------------------(end of
>broadcast)---------------------------
> > > > TIP 2: Don't 'kill -9' the postmaster
> > > >
> >
> >
> >
>
>---------------------------(end of broadcast)---------------------------
>TIP 4: Have you searched our list archives?
>
>                http://archives.postgresql.org