Re: Postgres tcp_keepalive_xxxx parameters.

From: José Luis Rando Calvo <jose(dot)luis(dot)rando(dot)calvo(at)ericsson(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Postgres tcp_keepalive_xxxx parameters.
Date: 2014-10-02 17:08:10
Message-ID: 703597748CEE3C47BE68861E8EDD19F4DD0CD1@ESESSMB307.ericsson.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi Tom,

First of all, thank you for your fast response!

I did not try to set up keepalives in client yet. This is a good point. We are using JDBC to connect to PG from JBoss application server.
I have seen the JDBC documentation and keepalive can be enabled when creating the connection to the database:

http://jdbc.postgresql.org/documentation/head/connect.html

Unfortunately seems to be tricky to enable it because I guess it implies to change the Java code. In that case it is not straight forward.
I do not know if there is a configuration file to set up this. I am going to look for it.

By the way, can you confirm me if keepalive behaves like I stated in my previous update...?

Thanks and best regards,

JL

-----Original Message-----
From: Tom Lane [mailto:tgl(at)sss(dot)pgh(dot)pa(dot)us]
Sent: miércoles, 01 de octubre de 2014 17:04
To: José Luis Rando Calvo
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: [GENERAL] Postgres tcp_keepalive_xxxx parameters.

jlrando <jose(dot)luis(dot)rando(dot)calvo(at)ericsson(dot)com> writes:
> We have an issue with postgres clients tha are being disconnected from
> database server after some time. Client is a web application which
> creates a pool of connections. Since client and server are on
> different VLANS I think the problem is that the FW which is routing
> traffic is droping idle connections after some time.

Probably. It might be asymmetric; have you tried enabling keepalives from the client end, rather than the server? If using libpq, you can set keepalive parameters in the connection string:
http://www.postgresql.org/docs/9.3/static/libpq-connect.html#LIBPQ-PARAMKEYWORDS

If that doesn't fix it, you might want to get out Wireshark or a similar tool and verify that keepalive packets are actually getting sent.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jonathan Vanasco 2014-10-02 20:13:16 Benching Queries
Previous Message Néstor Boscán 2014-10-02 16:15:46 Creating a PL/pgSQL function that returns multiple out parameters and refcursor