X-Original-To: pgsql-performance-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id C97C89FB25F for ; Mon, 7 Aug 2006 12:47:24 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 11076-08 for ; Mon, 7 Aug 2006 12:47:18 -0300 (ADT) X-Greylist: delayed 08:12:37.673141 by SQLgrey- Received: from mail.revver.com (mail.revver.com [207.7.147.37]) by postgresql.org (Postfix) with ESMTP id 631089FB225 for ; Mon, 7 Aug 2006 12:47:18 -0300 (ADT) Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.revver.com (Postfix) with ESMTP id 96628B5C0AD; Mon, 7 Aug 2006 08:47:17 -0700 (PDT) Received: from mail.revver.com ([127.0.0.1]) by localhost (neil.revver.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 30355-06; Mon, 7 Aug 2006 08:47:17 -0700 (PDT) Received: from [192.168.1.11] (c-66-229-34-91.hsd1.ca.comcast.net [66.229.34.91]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.revver.com (Postfix) with ESMTP id 1A724B5C067; Mon, 7 Aug 2006 08:47:17 -0700 (PDT) Message-ID: <44D7616D.6080906@revver.com> Date: Mon, 07 Aug 2006 08:51:09 -0700 From: "Donald C. Sumbry ][" User-Agent: Thunderbird 1.5.0.5 (Windows/20060719) MIME-Version: 1.0 To: Tom Lane CC: pgsql-performance@postgresql.org Subject: Re: High Context-Switches on Linux 8.1.4 Server References: <44D6EDFA.4030802@revver.com> <19629.1154955137@sss.pgh.pa.us> In-Reply-To: <19629.1154955137@sss.pgh.pa.us> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at revver.com X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200608/72 X-Sequence-Number: 20257 Tom Lane wrote: >> We're seeing an average of 30,000 context-switches a sec. This problem >> was much worse w/8.0 and got bearable with 8.1 but slowly resurfaced. > > Is this from LWLock or spinlock contention? strace'ing a few backends > could tell the difference: look to see how many select(0,...) you see > compared to semop()s. Also, how many of these compared to real work > (such as read/write calls)? Over a 20 second interval, I've got about 85 select()s and 6,230 semop()s. 2604 read()s vs 16 write()s. > Do you have any long-running transactions, and if so does shutting > them down help? There's been some discussion about thrashing of the > pg_subtrans buffers being a problem, and that's mainly a function of > the age of the oldest open transaction. Not long-running. We do have a badly behaving legacy app that is leaving some backends "idle in transaction" They're gone pretty quickly so I can't kill them fast enough, but running a pg_stat_activity will always show at least a handful. Could this be contributing? Based on the number of semop's we're getting it does look like shared_memory may be getting thrased - any suggestions? We did try lowering shared_memory usage in half the previous day, but that did little to help (it didn't make performance any worse and we still saw the high context-switches, but it didn't make it any better either). -- Sumbry][