Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 5F4E7637F20 for ; Tue, 2 Feb 2010 16:39:28 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 33255-01-10 for ; Tue, 2 Feb 2010 20:39:17 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from fg-out-1718.google.com (fg-out-1718.google.com [72.14.220.155]) by mail.postgresql.org (Postfix) with ESMTP id 891AC638165 for ; Tue, 2 Feb 2010 16:25:30 -0400 (AST) Received: by fg-out-1718.google.com with SMTP id l26so92128fgb.1 for ; Tue, 02 Feb 2010 12:25:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=fEk4nnJfHJ/5kyr+ZCA5qv0/XtVX6mMtaT4wX3/FX7M=; b=b+adKKVcAFAojpwNtVBVEDgBKrCroMbwNVJvXkqh8NL8oVg+81loBdO/oNXfhLKEpB tO0bDenIYpET1eZkatX1V7C5qgtUuRQblGxe8dtX9HSEX8FKadATQK1Ceifp+B3Vb3rG 7nAFAKpeCBfE5hIlRXlLkBIlqZHDJ/tDwWZgI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=IMOz/DmjQcWsm8qe0tNt/uvaViqLERV7HX1+DKc1T/FaB025bmceWqgFqfS1RY+qnH JHECCowIx+mvgdtedwgx08tAKZa7A/KL5E/vezQr9RKv0iB5tS5QrYv2Qwct93v3SZOx k1K/FE3w3+1wYPvy5ZdRgFiTK2iccsQwG5+zg= MIME-Version: 1.0 Received: by 10.216.90.1 with SMTP id d1mr3941105wef.136.1265142328818; Tue, 02 Feb 2010 12:25:28 -0800 (PST) In-Reply-To: <4B6878DF.3000004@yahoo.com> References: <4B6878DF.3000004@yahoo.com> Date: Tue, 2 Feb 2010 13:25:28 -0700 Message-ID: Subject: Re: System overload / context switching / oom, 8.3 From: Scott Marlowe To: Rob Cc: pgsql-performance@postgresql.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.599 tagged_above=-10 required=5 tests=BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 201002/32 X-Sequence-Number: 37453 On Tue, Feb 2, 2010 at 12:11 PM, Rob wrote: > pg 8.3.9, Debian Etch, 8gb ram, quadcore xeon, megaraid (more details at = end) > ~240 active databases, 800+ db connections via tcp. > > Everything goes along fairly well, load average from 0.5 to 4.0. =A0Disk > IO is writing about 12-20 MB every 4 or 5 seconds. =A0Cache memory about > 4gb. =A0Then under load, we see swapping and then context switch storm an= d > then oom-killer. SNIP > postgresql.conf: > max_connections =3D 1100 > work_mem =3D 32MB 32MB * 1000 =3D 32,000MB... And that's if you max out connections and they each only do 1 sort. If you're running many queries that run > 1 sorts it'll happen a lot sooner. Either drop max connections or work_mem is what I'd do to start with. If you have one or two reporting apps that need it higher, then set it higher for just those connections / users.