Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id AFAA8475B57 for ; Wed, 14 Aug 2002 05:45:02 -0400 (EDT) Received: from anchor-post-33.mail.demon.net (anchor-post-33.mail.demon.net [194.217.242.91]) by postgresql.org (Postfix) with ESMTP id EDA7D475B4F for ; Wed, 14 Aug 2002 05:45:01 -0400 (EDT) Received: from mwynhau.demon.co.uk ([193.237.186.96] helo=mainbox.archonet.com) by anchor-post-33.mail.demon.net with esmtp (Exim 3.35 #1) id 17eui6-000F5l-0X; Wed, 14 Aug 2002 10:45:03 +0100 Received: from client.archonet.com (client.archonet.com [192.168.1.16]) by mainbox.archonet.com (Postfix) with ESMTP id 3D48E11EB2; Wed, 14 Aug 2002 10:18:41 +0100 (BST) Content-Type: text/plain; charset="iso-8859-1" From: Richard Huxton Organization: Archonet Ltd To: Wei Weng , pgsql-sql@postgresql.org Subject: Re: concurrent connections is worse than serialization? Date: Wed, 14 Aug 2002 10:18:38 +0100 User-Agent: KMail/1.4.1 References: <1029271170.16828.7.camel@Monet> In-Reply-To: <1029271170.16828.7.camel@Monet> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200208141018.38875.dev@archonet.com> X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200208/219 X-Sequence-Number: 9065 On Tuesday 13 Aug 2002 9:39 pm, Wei Weng wrote: > I have a testing program that uses 30 concurrent connections > (max_connections =3D 32 in my postgresql.conf) and each does 100 > insertions to a simple table with index. > > It took me approximately 2 minutes to finish all of them. > > But under the same environment(after "delete From test_table, and vacuum > analyze"), I then queue up all those 30 connections one after another > one (serialize) and it took only 30 seconds to finish. > > Why is it that the performance of concurrent connections is worse than > serializing them into one? What was the limiting factor during the test? Was the CPU maxed, memory, di= sk=20 I/O? I take it the insert really *is* simple - no dependencies etc. > I was testing them using our own (proprietary) scripting engine and the > extension library that supports postgresql serializes the queries by > simply locking when a query manipulates a PGconn object and unlocking > when it is done. (And similiarly, it creates a PGconn object on the > stack for each concurrent queries.) I assume you've ruled the application end of things out. - Richard Huxton