Обсуждение: Surviving connections after internet problem

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

Surviving connections after internet problem

От
Durumdara
Дата:
Hello!


Linux server, 9.4 PG, Windows clients far-far away.

They called us that they had an "internet reset" at 13.00, but many client locks are alive now (14:00).
I checked server status, and and saw 16 connections.

In Windows PG server I read about keepalive parameters which are control and redefine default TCP keepalive values.

As I read it could be two hours in Windows, and it is a system default, so we can change for all applications.

I don't know what happens with Linux server and Windows clients.

May Linux version of PGSQL also uses 2 hour keepalive (default), or the it caused by Windows clients, or an active device?

Or how could they survive this internet connection reset? :-o

May we must limit these parameters in clients after the starting of the connection?

Thank you for your help!

    dd


Re: Surviving connections after internet problem

От
Albe Laurenz
Дата:
Durumdara wrote:
> Linux server, 9.4 PG, Windows clients far-far away.
> 
> They called us that they had an "internet reset" at 13.00, but many client locks are alive now
> (14:00).
> I checked server status, and and saw 16 connections.
> 
> In Windows PG server I read about keepalive parameters which are control and redefine default TCP
> keepalive values.
> 
> As I read it could be two hours in Windows, and it is a system default, so we can change for all
> applications.
> 
> I don't know what happens with Linux server and Windows clients.
> 
> May Linux version of PGSQL also uses 2 hour keepalive (default), or the it caused by Windows clients,
> or an active device?
> 
> Or how could they survive this internet connection reset? :-o
> 
> May we must limit these parameters in clients after the starting of the connection?

Don't bother about the clients, just see that the backends go away on the server.

You can use pg_terminate_backend to kill a database session.

Setting the keepalive options in postgresql.conf can make PostgreSQL
discover dead connections more quickly.

Yours,
Laurenz Albe

Re: Surviving connections after internet problem

От
Durumdara
Дата:
Dear Laurenz!


2016-11-07 16:06 GMT+01:00 Albe Laurenz <laurenz.albe@wien.gv.at>:
Durumdara wrote:
> Linux server, 9.4 PG, Windows clients far-far away.
> May we must limit these parameters in clients after the starting of the connection?

Don't bother about the clients, just see that the backends go away on the server.

You can use pg_terminate_backend to kill a database session.

Setting the keepalive options in postgresql.conf can make PostgreSQL
discover dead connections more quickly.

The server is licenced, so we can't access the conf file now.
We will report this to the provider.

For that moment could we set these parameters from clients after the connection established?

For example:

set param bla = nnn?

Thank you!

Regards
   dd


Re: Surviving connections after internet problem

От
Albe Laurenz
Дата:
Durumdara wrote:
>> You can use pg_terminate_backend to kill a database session.
>>
>> Setting the keepalive options in postgresql.conf can make PostgreSQL
>> discover dead connections more quickly.
> 
> The server is licenced, so we can't access the conf file now.
> We will report this to the provider.

You cannot use ALTER SYSTEM from SQL either?

> For that moment could we set these parameters from clients after the connection established?
> 
> For example:
> 
> set param bla = nnn?

Yes, that should work, e.g.:

SET tcp_keepalives_idle = 600;

Yours,
Laurenz Albe