Обсуждение: my connections never die

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

my connections never die

От
Ben Carterette
Дата:
I'm running a web server on one machine (Apache 1.3+Tomcat 3.2+mod_jk)
with some databases (postgresql 7.1), and a dedicated database server on
another machine (postgresql 7.0.2).  A lot of my web pages establish a
connection to a database on either machine and store the Connection
object in a session so's I don't have to create a new one every page.
Well, it seems these connections, which never get explicitly closed, are
never dying.  Some of them, anyway.  I haven't been able to predict
which ones are going to close themselves and which ones will stay open
for days, but some of them are still taking up a process days later.

Greatly appreciating any explanation,
Ben Carterette
bcarterette@mail.liberty.k12.mo.us



Re: my connections never die

От
Hunter Hillegas
Дата:
Are you using servlets?

I would have to say that not explicitly closing connections is bad... If you
are using servlets, you can register an event for when the session expires
to close the connection. That way you know it's not hanging on to stuff
forever.

Hunter

> From: Ben Carterette <bcarterette@mail.liberty.k12.mo.us>
> Organization: Liberty Public School District
> Date: Thu, 10 May 2001 11:11:05 -0500
> To: pgsql-general@postgresql.org
> Subject: [GENERAL] my connections never die
>
> I'm running a web server on one machine (Apache 1.3+Tomcat 3.2+mod_jk)
> with some databases (postgresql 7.1), and a dedicated database server on
> another machine (postgresql 7.0.2).  A lot of my web pages establish a
> connection to a database on either machine and store the Connection
> object in a session so's I don't have to create a new one every page.
> Well, it seems these connections, which never get explicitly closed, are
> never dying.  Some of them, anyway.  I haven't been able to predict
> which ones are going to close themselves and which ones will stay open
> for days, but some of them are still taking up a process days later.
>
> Greatly appreciating any explanation,
> Ben Carterette
> bcarterette@mail.liberty.k12.mo.us


Re: my connections never die

От
"Dominic J. Eidson"
Дата:
On Thu, 10 May 2001, Ben Carterette wrote:

> I'm running a web server on one machine (Apache 1.3+Tomcat 3.2+mod_jk)
> with some databases (postgresql 7.1), and a dedicated database server on
> another machine (postgresql 7.0.2).  A lot of my web pages establish a
> connection to a database on either machine and store the Connection
> object in a session so's I don't have to create a new one every page.
> Well, it seems these connections, which never get explicitly closed, are
> never dying.  Some of them, anyway.  I haven't been able to predict
> which ones are going to close themselves and which ones will stay open
> for days, but some of them are still taking up a process days later.

This is not unusual, if you are using persistant connections to
PostgreSQL..

[dominic@postgres dominic]$ ps xauwf | grep 'post'
postgres 15530  0.0  0.0  5924  492 ?        S     2000   0:35 /usr/bin/postmaster
postgres 16865  0.0  0.3  6180 2048 ?        S    Feb13   0:02  \_ /usr/bin/postgres
postgres 16928  0.0  0.3  6152 2008 ?        S    Feb13   0:02  \_ /usr/bin/postgres
postgres 25289  0.0  0.5  6184 2820 ?        S    Feb27   0:06  \_ /usr/bin/postgres
postgres 25290  0.0  0.5  6136 2788 ?        S    Feb27   0:06  \_ /usr/bin/postgres
postgres 25291  0.0  0.5  6168 2820 ?        S    Feb27   0:07  \_ /usr/bin/postgres
postgres 25292  0.0  0.5  6176 2800 ?        S    Feb27   0:05  \_ /usr/bin/postgres
postgres 25293  0.0  0.5  6152 2796 ?        S    Feb27   0:06  \_ /usr/bin/postgres
postgres 13625  0.0  0.5  6140 2788 ?        S    Mar06   0:05  \_ /usr/bin/postgres
postgres 11336  0.0  0.5  6148 2784 ?        S    Mar27   0:02  \_ /usr/bin/postgres
postgres 11337  0.0  0.5  6148 2692 ?        S    Mar27   0:02  \_ /usr/bin/postgres
postgres 32236  0.0  0.5  6272 2840 ?        S    Apr03   0:02  \_ /usr/bin/postgres
postgres  3947  0.0  0.5  6284 2800 ?        S    Apr05   0:01  \_ /usr/bin/postgres

As you can see, we've got several postgres backends running... We just let
them sit there.

--
Dominic J. Eidson
                                        "Baruk Khazad! Khazad ai-menu!" - Gimli
-------------------------------------------------------------------------------
http://www.the-infinite.org/              http://www.the-infinite.org/~dominic/