Received: from localhost (unknown [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id B827D2E003D for ; Tue, 26 Feb 2008 12:27:22 -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 17319-09 for ; Tue, 26 Feb 2008 12:27:19 -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 58EEF2E0039 for ; Tue, 26 Feb 2008 12:27:19 -0400 (AST) Received: from mac.com (asmtp007-s [10.150.69.70]) by smtpoutm.mac.com (Xserve/smtpout018/MantshX 4.0) with ESMTP id m1QGRIip005929; Tue, 26 Feb 2008 08:27:18 -0800 (PST) Received: from [10.0.1.253] (75-144-26-241-sfba-ca.hfc.comcastbusiness.net [75.144.26.241] (may be forged)) (authenticated bits=0) by mac.com (Xserve/asmtp007/MantshX 4.0) with ESMTP id m1QGQU9w027149 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 26 Feb 2008 08:26:45 -0800 (PST) Mime-Version: 1.0 Message-Id: In-Reply-To: <6730.1203829093@sss.pgh.pa.us> References: <5576.1203795335@sss.pgh.pa.us> <6730.1203829093@sss.pgh.pa.us> Date: Tue, 26 Feb 2008 08:26:30 -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/342 X-Sequence-Number: 28884 At 11:58 PM -0500 2/23/08, Tom Lane wrote: > > Attached is a perl script that sort of simulates what's going on. > >Thanks for the script. It's not showing any particular problems here, >though. With log_min_duration_statement = 10, the only statements that >(slightly) exceed 10ms are the select count(*) from generate_series(1, >15000) ones. I tried the test script on another machine (similar but not identical to the original machine) running 8.3 and although the notify performance was *much* better than the original I still see notifications taking longer than the select count(*) from generate_series(1, 15000) queries, and also longer than some simple updates to other tables that are also happening on the server. duration: 10.030 ms statement: select count(*) from generate_series(1, 15000) duration: 224.833 ms statement: NOTIFY to_producer Perhaps this shouldn't be made much of as I'm sure there are many way that this could quite naturally happen. I've been thinking of LISTEN / NOTIFY as one of the least expensive and therefore speedy ways to get the word out to participating processes that something has changed (versus using a manually setup signals table that interested parties updated and selected from). Now that I see a little bit more of what goes on under the hood of this function I see that it's still basically table-driven and I'll adjust my expectations accordingly, but I'm still puzzled by the hugely slow notifications showing up on the original server running the producer / consumer setup. With ps I can see some postgres backends with a 'notify interrupt waiting' command line during the tests - could it be an issue with signal handling on the original machine - something entirely outside of PG's control? Thx, -Joel