Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 1C99A1337B50 for ; Wed, 29 Dec 2010 15:28:42 -0400 (AST) 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 08203-05 for ; Wed, 29 Dec 2010 19:28:34 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail-fx0-f46.google.com (mail-fx0-f46.google.com [209.85.161.46]) by mail.postgresql.org (Postfix) with ESMTP id 421631337B4F for ; Wed, 29 Dec 2010 15:28:33 -0400 (AST) Received: by fxm20 with SMTP id 20so10714018fxm.19 for ; Wed, 29 Dec 2010 11:28:33 -0800 (PST) Received: by 10.223.75.194 with SMTP id z2mr1161041faj.38.1293650911773; Wed, 29 Dec 2010 11:28:31 -0800 (PST) Received: from Craig-Jamess-MacBook-Pro.local (cpe-76-176-215-35.san.res.rr.com [76.176.215.35]) by mx.google.com with ESMTPS id 17sm3612398far.19.2010.12.29.11.28.29 (version=SSLv3 cipher=RC4-MD5); Wed, 29 Dec 2010 11:28:30 -0800 (PST) Message-ID: <4D1B8BD9.4060105@emolecules.com> Date: Wed, 29 Dec 2010 11:28:25 -0800 From: Craig James User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.13) Gecko/20101207 Thunderbird/3.1.7 MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: long wait times in ProcessCatchupEvent() References: In-Reply-To: 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=-10 required=5 tests=BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7 X-Spam-Level: X-Archive-Number: 201012/328 X-Sequence-Number: 41780 On 12/29/10 6:28 AM, Julian v. Bock wrote: > I have the problem that on our servers it happens regularly under a > certain workload (several times per minute) that all backend processes > get a SIGUSR1 and spend several seconds in ProcessCatchupEvent(). At > 100-200 connections (most of them idle) this causes the system load to > skyrocket. I am not really familiar with the code but my wild guess is > that the processes spend most of their time waiting for spinlocks. > > We have reduced the number of connections as much as possible for now > but it still makes up for roughly 50% of the total CPU time. Has > anyone experienced a similar problem? > > I can reproduce the issue on a test system with production data but it > is not so easy to pinpoint what exactly causes the problem. The queries > are basically tsearch2 full text searches over moderately big tables > (~35GB). The queries are performed by functions which aggregate data > from partitions in temporary tables, cache some data, and perform > calculations before returning it to the user. > > The PostgreSQL version is 8.3.12, the test server has 8 amd64 cores > and 16GB of ram. I experimented with shared_buffers between 1GB and > 4GB but it doesn't make much of a difference. Disk IO doesn't seem to > be an issue here. This sounds like the exact same problem I had on Postgres 8.3 and 8.4: http://archives.postgresql.org/pgsql-performance/2010-04/msg00071.php Updating to Postgres version 9 fixed it. Here is what appeared to be the best analysis of what was happening, but we never confirmed it. http://archives.postgresql.org/pgsql-performance/2010-06/msg00464.php Craig