Received: from localhost (pluto.hub.org [200.46.204.4]) by postgresql.org (Postfix) with ESMTP id DB2D09FA14D for ; Tue, 7 Nov 2006 13:42:25 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.4]) (amavisd-new, port 10024) with ESMTP id 66529-03 for ; Tue, 7 Nov 2006 13:42:22 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from davinci.ethosmedia.com (server227.ethosmedia.com [209.128.84.227]) by postgresql.org (Postfix) with ESMTP id 3B7E99F9AD7 for ; Tue, 7 Nov 2006 13:42:23 -0400 (AST) X-EthosMedia-Virus-Scanned: no infections found Received: from [63.195.55.98] (account josh@agliodbs.com HELO spooky.sf.agliodbs.com) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) with ESMTP id 10534405; Tue, 07 Nov 2006 09:46:00 -0800 From: Josh Berkus Organization: PostgreSQL @ Sun To: pgsql-performance@postgresql.org, carlos.reimer@opendb.com.br Subject: Re: Context switching Date: Tue, 7 Nov 2006 09:42:26 -0800 User-Agent: KMail/1.8.2 References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200611070942.26663.josh@agliodbs.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200611/80 X-Sequence-Number: 21850 Carlos, > We've migrated one of our servers from pg 7.4 to 8.1 and from times to > times (4 hours) the server start doing a lot of context switching and all > transactions become very slow. > > The average context switching for this server as vmstat shows is 1 but when > the problem occurs it goes to 250000. Context Switching is a symptom rather than a cause. What's most likely happening is that you have a combined heavy-CPU and heavy-IO workload, so you have bursts of CPU activity stalled by iowaits. Can you check the rate of iowaits during the "storm" periods? Also, is this Xeon? And are you saying that you *didn't* have this issue under 7.4? -- Josh Berkus PostgreSQL @ Sun San Francisco