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 2479D53E1A; Wed, 13 Apr 2005 14:03:37 -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 05454-02; Wed, 13 Apr 2005 17:03:33 +0000 (GMT) Received: from mir3-fs.mir3.com (unknown [216.74.11.46]) by svr1.postgresql.org (Postfix) with ESMTP id 9824553E19; Wed, 13 Apr 2005 14:03:32 -0300 (ADT) Received: from amateljan.mirlogic.com ([172.16.2.68]) by mir3-fs.mir3.com with Microsoft SMTPSVC(5.0.2195.5329); Wed, 13 Apr 2005 09:44:38 -0700 Subject: Re: [PERFORM] Many connections lingering From: Mark Lewis To: Slavisa Garic Cc: Greg Stark , Tom Lane , pgsql-performance@postgresql.org, pgsql-novice@postgresql.org In-Reply-To: References: <2314.1113360715@sss.pgh.pa.us> <87u0mbjr02.fsf@stark.xeocode.com> Content-Type: text/plain Organization: MIR3, Inc. Message-Id: <1113410549.5589.62.camel@amateljan.mirlogic.com> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.4 (1.4.4-3) Date: Wed, 13 Apr 2005 09:42:29 -0700 Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 13 Apr 2005 16:44:38.0260 (UTC) FILETIME=[14E98B40:01C54048] X-Virus-Scanned: by amavisd-new at hub.org X-Archive-Number: 200504/242 X-Sequence-Number: 13125 If there are potentially hundreds of clients at a time, then you may be running into the maximum connection limit. In postgresql.conf, there is a max_connections setting which IIRC defaults to 100. If you try to open more concurrent connections to the backend than that, you will get a connection refused. If your DB is fairly gnarly and your performance needs are minimal it should be safe to increase max_connections. An alternative approach would be to add some kind of database broker program. Instead of each agent connecting directly to the database, they could pass their data to a broker, which could then implement connection pooling. -- Mark Lewis On Tue, 2005-04-12 at 22:09, Slavisa Garic wrote: > This is a serious problem for me as there are multiple users using our > software on our server and I would want to avoid having connections > open for a long time. In the scenario mentioned below I haven't > explained the magnitute of the communications happening between Agents > and DBServer. There could possibly be 100 or more Agents per > experiment, per user running on remote machines at the same time, > hence we need short transactions/pgsql connections. Agents need a > reliable connection because failure to connect could mean a loss of > computation results that were gathered over long periods of time.