RES: [GENERAL] PostgreSQL keepalives help

From: Kananda <Kananda(at)stepsoftware(dot)com(dot)br>
To: Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>
Cc: "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org>
Subject: RES: [GENERAL] PostgreSQL keepalives help
Date: 2010-07-30 11:58:10
Message-ID: 4A704C139DFD804DB74FFB9CC0BE79FC790B5631C5@SBS.step.local
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-general

No.. I'm not in linux! OS: Windows 7 (client) / Windows Server 2008 (server)

Thanks

Kananda S Silveira - Desenvolvedora .NET / Analista de Banco de Dados
STEP SOFTWARE Tecnologia e Projetos LTDA
kananda(at)stepsoftware(dot)com(dot)br / +55(48)8417-8121
________________________________________
De: Scott Marlowe [scott(dot)marlowe(at)gmail(dot)com]
Enviado: quinta-feira, 29 de julho de 2010 21:02
Para: Kananda
Cc: pgsql-admin(at)postgresql(dot)org
Assunto: Re: [GENERAL] PostgreSQL keepalives help

!!! Please do not post to multiple lists. Pick one, see what bites
you get, wait, then try another if no one answers. I'm removing all
but pgsql-admin from this post !!!

On Thu, Jul 29, 2010 at 2:16 PM, Kananda <Kananda(at)stepsoftware(dot)com(dot)br> wrote:
> Hy,
>
> I have a system working with the client-server structure and PostgreSQL 8.4.

What OS?

> My problem is that if a client who is editing a record and lose his
> connection to the server,the TCPIP connection is still considered! So, the
> record stay allocated for the client in my database.
> I need the records are free for edit, in few minutes. Therefore I set the
> KEEPALIVE configuration in my "postgresql.conf":
>
> tcp_keepalives_idle = 60 # TCP_KEEPIDLE, in seconds;
> tcp_keepalives_interval = 60 # TCP_KEEPINTVL, in seconds;
> tcp_keepalives_count TCP_KEEPCNT = 5 #;
>
> After making these settings and restart the server, the system continues to
> function the same way: Just breaks the connection TCPIP after two hours and
> then deallocates the records in PostgreSQL. I need a efficient and safe way
> for the PostgreSQL understand that is to break these connections as
> configured! I need help, urgent!

I'll assume you're on linux, in which case try setting those values
with sysctl like so:

Edit /etc/sysctl.conf. add these lines at the bottom:

net.ipv4.tcp_keepalive_time = 300
net.ipv4.tcp_keepalive_probes = 2
net.ipv4.tcp_keepalive_intvl = 30

Then run "sudo sysctl -p"

See if the changes took effect:

sysctl -a|grep keepa

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Richard Huxton 2010-07-30 13:51:51 Re: PostgreSQL keepalives help
Previous Message Scott Marlowe 2010-07-30 00:02:14 Re: [GENERAL] PostgreSQL keepalives help

Browse pgsql-general by date

  From Date Subject
Next Message Brad Nicholson 2010-07-30 12:41:58 Re: Which CMS/Ecommerce/Shopping cart ?
Previous Message Alban Hertroys 2010-07-30 10:48:31 Re: How to improve: performance of query on postgresql 8.3 takes days