From Kananda@stepsoftware.com.br Thu Jul 29 20:22:23 2010 Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 49912632B31; Thu, 29 Jul 2010 17:22:23 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 93757-09; Thu, 29 Jul 2010 20:22:14 +0000 (UTC) X-Greylist: delayed 00:05:24.26633 by SQLgrey-1.7.6 X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from remote.stepsoftware.com.br (step.funcitec.rct-sc.br [189.8.192.142]) by mail.postgresql.org (Postfix) with ESMTP id 9739D632346; Thu, 29 Jul 2010 17:22:14 -0300 (ADT) Received: from SBS.step.local ([fe80::3df9:2e60:f833:73b7]) by SBS.step.local ([fe80::3df9:2e60:f833:73b7%10]) with mapi; Thu, 29 Jul 2010 17:16:45 -0300 From: Kananda To: "pgsql-general@postgresql.org" , "pgsql-admin@postgresql.org" , "pgsql-cluster-hackers@postgresql.org" Date: Thu, 29 Jul 2010 17:16:44 -0300 Subject: PostgreSQL keepalives help Thread-Topic: PostgreSQL keepalives help Thread-Index: AQHLL1r2cVfbQweWN0u1mWv+dyYpew== Message-ID: <4A704C139DFD804DB74FFB9CC0BE79FC790B5631C3@SBS.step.local> Accept-Language: pt-BR Content-Language: pt-BR X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: pt-BR Content-Type: multipart/alternative; boundary="_000_4A704C139DFD804DB74FFB9CC0BE79FC790B5631C3SBSsteplocal_" MIME-Version: 1.0 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.801 tagged_above=-10 required=5 tests=BAYES_50=0.8, HTML_MESSAGE=0.001 X-Spam-Level: X-Archive-Number: 201008/13 X-Sequence-Number: 35262 --_000_4A704C139DFD804DB74FFB9CC0BE79FC790B5631C3SBSsteplocal_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hy, I have a system working with the client-server structure and PostgreSQL 8.4= . My problem is that if a client who is editing a record and lose his connect= ion 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 K= EEPALIVE configuration in my "postgresql.conf": tcp_keepalives_idle =3D 60 # TCP_KEEPIDLE, in seconds; tcp_keepalives_interval =3D 60 # TCP_KEEPINTVL, in seconds; tcp_keepalives_count TCP_KEEPCNT =3D 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 an= d then deallocates the records in PostgreSQL. I need a efficient and safe w= ay for the PostgreSQL understand that is to break these connections as conf= igured! I need help, urgent! Thanks, Kananda S Silveira - Desenvolvedora .NET / Analista de Banco de Dados STEP SOFTWARE Tecnologia e Projetos LTDA kananda@stepsoftware.com.br / +55(48)84= 17-8121 --_000_4A704C139DFD804DB74FFB9CC0BE79FC790B5631C3SBSsteplocal_ Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Hy,
 
I have a system working w= ith the client-server structure and PostgreSQL 8.4.
My problem is that if a client who is editing a record and lose his connect= ion 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 K= EEPALIVE configuration in my "postgresql.conf":
 
tcp_keepalives_idle =3D 6= 0 # TCP_KEEPIDLE, in seconds;
tcp_keepalives_interval =3D 60 # TCP_KEEPINTVL, in seconds;
tcp_keepalives_count TCP_KEEPCNT =3D 5 #;
 
After making these settin= gs and restart the server, the system continues to function the same way: J= ust breaks the connection TCPIP after two hours and then deallocates the re= cords in PostgreSQL. I need a efficient and safe way for the PostgreSQL understand that is to break these connecti= ons as configured! I need help, urgent!
 
Thanks,
 
Kananda S Silveira - Desenvolvedora .NET= / Analista de Banco de Dados
STEP SOFTWARE Tecnologia e Projetos LTDA<= /strong>
kananda@stepsof= tware.com.br / +55(4= 8)8417-8121
--_000_4A704C139DFD804DB74FFB9CC0BE79FC790B5631C3SBSsteplocal_-- From scott.marlowe@gmail.com Fri Jul 30 00:02:24 2010 Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id A058662FA79 for ; Thu, 29 Jul 2010 21:02:24 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 06874-01 for ; Fri, 30 Jul 2010 00:02:17 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wy0-f174.google.com (mail-wy0-f174.google.com [74.125.82.174]) by mail.postgresql.org (Postfix) with ESMTP id C1F22633145 for ; Thu, 29 Jul 2010 21:02:16 -0300 (ADT) Received: by wyb39 with SMTP id 39so672354wyb.19 for ; Thu, 29 Jul 2010 17:02:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type; bh=ZsgBfx8AIcEAz+PBcsPpKadcJEmCeAU3vehCe1c7zZ0=; b=MW18XYyVE+GHc35iBDvR42EGuvVqHqvaDpUIQozi+UjuWttdRlBq5OteRW8++2lPlg orCU1kKe3Zd07z6RJZ2hHnR3oVEC4OqCUevr1yCLNQreQ7A7siJWcYAxQLGBBbgTn6RP 7ttSCyeT/JowJX6a3Bhp3JR123YtWA2PThM0I= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=jAJf/aEp9qadBRFMXBAO1D+X6juYAoCkug9ZClnj/h8Itp0eNWTGpniivrAnMLSiHv zdRVE+ZKihG33AnA2zjlMKh2VHuSllgRqKYsYGJIQwnOXUxkKrK9QGtcZ50XXYl8f5i8 xjRb8/fwGLjKg4eaO62/QMWkP2MReqX3/FzcE= MIME-Version: 1.0 Received: by 10.227.12.164 with SMTP id x36mr922117wbx.97.1280448134810; Thu, 29 Jul 2010 17:02:14 -0700 (PDT) Received: by 10.227.127.72 with HTTP; Thu, 29 Jul 2010 17:02:14 -0700 (PDT) In-Reply-To: <4A704C139DFD804DB74FFB9CC0BE79FC790B5631C3@SBS.step.local> References: <4A704C139DFD804DB74FFB9CC0BE79FC790B5631C3@SBS.step.local> Date: Thu, 29 Jul 2010 18:02:14 -0600 Message-ID: Subject: Re: [GENERAL] PostgreSQL keepalives help From: Scott Marlowe To: Kananda Cc: "pgsql-admin@postgresql.org" Content-Type: text/plain; charset=ISO-8859-1 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-10 required=5 tests=BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001 X-Spam-Level: X-Archive-Number: 201007/212 X-Sequence-Number: 35231 !!! 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 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 From dev@archonet.com Fri Jul 30 13:52:11 2010 Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 23BF36324F0 for ; Fri, 30 Jul 2010 10:52:11 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 35661-01 for ; Fri, 30 Jul 2010 13:52:03 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from relay.pcl-ipout01.plus.net (relay.pcl-ipout01.plus.net [212.159.7.99]) by mail.postgresql.org (Postfix) with ESMTP id A6373632257 for ; Fri, 30 Jul 2010 10:52:03 -0300 (ADT) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvsEAFd2UkxUXeb0/2dsb2JhbACgF3HAUoU5BA Received: from outmx03.plus.net ([84.93.230.244]) by relay.pcl-ipout01.plus.net with ESMTP; 30 Jul 2010 14:51:52 +0100 Received: from 84-51-143-99.archon037.adsl.metronet.co.uk ([84.51.143.99] helo=server3.office.archonet.com) by outmx03.plus.net with esmtp (Exim) id 1Oeq07-0006q5-NB; Fri, 30 Jul 2010 14:51:51 +0100 Received: from [192.168.1.36] (dell36.office.archonet.com [192.168.1.36]) by server3.office.archonet.com (Postfix) with ESMTPA id 6FA6D274118; Fri, 30 Jul 2010 14:51:51 +0100 (BST) Message-ID: <4C52D8F7.6020705@archonet.com> Date: Fri, 30 Jul 2010 14:51:51 +0100 From: Richard Huxton User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.11) Gecko/20100713 Lightning/1.0b1 Thunderbird/3.0.6 MIME-Version: 1.0 To: Kananda CC: "pgsql-general@postgresql.org" Subject: Re: PostgreSQL keepalives help References: <4A704C139DFD804DB74FFB9CC0BE79FC790B5631C3@SBS.step.local> In-Reply-To: <4A704C139DFD804DB74FFB9CC0BE79FC790B5631C3@SBS.step.local> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.6 tagged_above=-5 required=5 tests=BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7 X-Spam-Level: X-Archive-Number: 201007/1012 X-Sequence-Number: 165897 On 29/07/10 21:16, Kananda wrote: > 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 #; If this is actually what you have in your file, you have an error in your count setting. Try "show tcp_keepalives_count;" and so on - just check they're set as you expect them to be. If they have the right values, put wireshark or some other network monitor onto the connection and see if any packets are being sent back and fore while there is no real traffic. Oh, and please don't cross-post to multiple lists (particular -cluster-hackers - can't see the relevance of that). -- Richard Huxton Archonet Ltd