X-Original-To: pgsql-novice-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 337B2533B9; Wed, 13 Apr 2005 02:01:54 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 84856-05; Wed, 13 Apr 2005 05:01:52 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 21371533B3; Wed, 13 Apr 2005 02:01:51 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j3D51e6n003373; Wed, 13 Apr 2005 01:01:40 -0400 (EDT) To: Greg Stark Cc: Slavisa Garic , pgsql-performance@postgresql.org, pgsql-novice@postgresql.org Subject: Re: [PERFORM] Many connections lingering In-reply-to: <87u0mbjr02.fsf@stark.xeocode.com> References: <2314.1113360715@sss.pgh.pa.us> <87u0mbjr02.fsf@stark.xeocode.com> Comments: In-reply-to Greg Stark message dated "12 Apr 2005 23:27:09 -0400" Date: Wed, 13 Apr 2005 01:01:40 -0400 Message-ID: <3372.1113368500@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200504/162 X-Sequence-Number: 13045 Greg Stark writes: > Tom Lane writes: >> This is a network-level issue: the TCP stack on your machine knows the >> connection has been closed, but it hasn't seen an acknowledgement of >> that fact from the other machine, and so it's remembering the connection >> number so that it can definitively say "that connection is closed" if >> the other machine asks. > No, what Tom's describing is a different pair of states called FIN_WAIT_1 and > FIN_WAIT_2. TIME_WAIT isn't waiting for a packet, just a timeout. D'oh, obviously it's been too many years since I read Stevens ;-) So AFAICS this status report doesn't actually indicate any problem, other than massively profligate use of separate connections. Greg's correct that there's some risk of resource exhaustion at the TCP level, but it's not very likely. I'd be more concerned about the amount of resources wasted in starting a separate Postgres backend for each connection. PG backends are fairly heavyweight objects --- if you are at all concerned about performance, you want to get a decent number of queries done in each connection. Consider using a connection pooler. regards, tom lane