Обсуждение: Fwd: Postgresql

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

Fwd: Postgresql

От
Gary Stainburn
Дата:
Hi folks,

This was posted to one of the redhat lists and it got me thinking.

I would imagine that there is some sort of limit otherwise stale connections
could be left hanging around forever.  However, PHP supports persistant
connections where it can go days without anyone accessing a page.

So what is the answer to the question below?

----------  Forwarded Message  ----------

Subject: Postgresql
Date: Fri, 31 Jan 2003 08:10:53 -0600
From: "Delao, Darryl W" <ddelao@ou.edu>
To: "'redhat-list@redhat.com'" <redhat-list@redhat.com>

Anyone know if postgres has a connections limit by default?  I see a
connections limit in my conf file but it is commented out..Just curious what
the default limit is, if any.

Darryl



--
redhat-list mailing list
unsubscribe mailto:redhat-list-request@redhat.com?subject=unsubscribe
https://listman.redhat.com/mailman/listinfo/redhat-list

-------------------------------------------------------

--
Gary Stainburn

This email does not contain private or confidential material as it
may be snooped on by interested government parties for unknown
and undisclosed purposes - Regulation of Investigatory Powers Act, 2000


Re: Fwd: Postgresql

От
Gary Stainburn
Дата:
On Monday 03 February 2003 2:39 pm, you wrote:
> > Anyone know if postgres has a connections limit by default?  I see a
> > connections limit in my conf file but it is commented out..Just curious
> > what the default limit is, if any.
>
> 32, compile with --with-maxbackends=N, where N is your max. connection
> number.
>
> Egon

Thanks for that Egon.

I didn't read the OP properly.  I thought it was asking how Postgresql handled
STALE connections.

The specific situation I have in mind is that inside my firewall's DMZ I have
an Apache server running PHP. This PHP opens a persistant connection through
the firewall to a postgresql service in another DMZ.  If I reboot the
firewall, the PHP connection is lost and to get my PHP working again I have
to restart Apache (If anyone can suggest how I can either get round of
automate this I'd appreciate it).

How does Postgresql handle this?  I would hope that it would notice the loss
of the IP connection and close the link gracefully, and not just leave the
connectino dangling.

Can anyone confirm this?
--
Gary Stainburn

This email does not contain private or confidential material as it
may be snooped on by interested government parties for unknown
and undisclosed purposes - Regulation of Investigatory Powers Act, 2000


Re: Fwd: Postgresql

От
Tom Lane
Дата:
Gary Stainburn <gary.stainburn@ringways.co.uk> writes:
> How does Postgresql handle this?  I would hope that it would notice the loss
> of the IP connection and close the link gracefully, and not just leave the
> connectino dangling.

The backend runs the connection with TCP_KEEPALIVE set.  The kernel
should recognize the loss of connectivity after awhile ("awhile" means
an hour or more if your kernel does this in an RFC-compliant fashion)
and inform the backend, which will roll back any open transaction and
then shut down.

If connectivity was lost while active data transfer was going on,
it will probably only take a few minutes for the kernel to declare
connection loss.  But if you were sitting idle, nothing will happen
until the kernel issues a KEEPALIVE probe, which it shouldn't do very
often.

            regards, tom lane