Received: from localhost (unknown [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id B1D622E0D9B for ; Mon, 25 Feb 2008 15:24:12 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 60484-01-7 for ; Mon, 25 Feb 2008 15:24:05 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.5 Received: from smtpoutm.mac.com (smtpoutm.mac.com [17.148.16.81]) by postgresql.org (Postfix) with ESMTP id 4C9842E0247 for ; Mon, 25 Feb 2008 15:16:03 -0400 (AST) Received: from mac.com (asmtp005-s [10.150.69.68]) by smtpoutm.mac.com (Xserve/smtpout018/MantshX 4.0) with ESMTP id m1PJG2AW027540; Mon, 25 Feb 2008 11:16:02 -0800 (PST) Received: from [192.168.0.9] ([38.99.35.195]) (authenticated bits=0) by mac.com (Xserve/asmtp005/MantshX 4.0) with ESMTP id m1PJFs8Y012269 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 25 Feb 2008 11:15:54 -0800 (PST) Mime-Version: 1.0 Message-Id: In-Reply-To: <29568.1203963194@sss.pgh.pa.us> References: <29568.1203963194@sss.pgh.pa.us> Date: Mon, 25 Feb 2008 11:15:44 -0800 To: Tom Lane From: Joel Stevenson Subject: Re: LISTEN / NOTIFY performance in 8.3 Cc: pgsql-performance@postgresql.org Content-Type: text/plain; charset="us-ascii" ; format="flowed" X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200802/328 X-Sequence-Number: 28870 At 1:13 PM -0500 2/25/08, Tom Lane wrote: >Joel Stevenson writes: >>> Also, it might be worth enabling log_lock_waits to see if the slow >>> notifies are due to having to wait on some lock or other. > >> Turning on log_lock_waits shows that there is a lot of waiting for >> locks on the pg_listener table ala: > >Interesting. The LISTEN/NOTIFY mechanism itself takes ExclusiveLock >on pg_listener, but never for very long at a time (assuming pg_listener >doesn't get horribly bloated, which we know isn't happening for you). > >Another thought that comes to mind is that maybe the delays you see >come from these lock acquisitions getting blocked behind autovacuums of >pg_listener. I did not see that while trying to replicate your problem, >but maybe the issue requires more update load on pg_listener than the >test script can create by itself, or maybe some nondefault autovacuum >setting is needed --- what are you using? Default autovacuum settings. I turned on all autovacuum logging and cranked up the test script and have it fork 25 consumers each running 25 iterations. At that level on my machine I can get the lock waiting to exceed the 1s deadlock_timeout right away but the autovacuum activity on pg_listener is entirely absent until the end when the forked consumers are mostly done and disconnected.