Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 5F9A99F9B43 for ; Fri, 21 Sep 2007 05:03:16 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 80733-02 for ; Fri, 21 Sep 2007 05:03:10 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from oxford.xeocode.com (unknown [87.127.95.196]) by postgresql.org (Postfix) with ESMTP id E3D419F9B3D for ; Fri, 21 Sep 2007 05:03:09 -0300 (ADT) Received: from localhost ([127.0.0.1] helo=oxford.xeocode.com) by oxford.xeocode.com with esmtp (Exim 4.67) (envelope-from ) id 1IYdTc-0001hl-Og; Fri, 21 Sep 2007 09:03:04 +0100 To: "Tom Lane" Cc: "Decibel!" , Subject: Re: Linux mis-reporting memory In-Reply-To: <16213.1190329934@sss.pgh.pa.us> (Tom Lane's message of "Thu\, 20 Sep 2007 19\:12\:14 -0400") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux) X-Draft-From: ("nnimap+mail01.enterprisedb.com:INBOX.performance" 2542) References: <20070920230400.GM95343@decibel.org> <16213.1190329934@sss.pgh.pa.us> From: Gregory Stark Organization: EnterpriseDB Date: Fri, 21 Sep 2007 09:03:04 +0100 Message-ID: <87r6ksa1jb.fsf@oxford.xeocode.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200709/348 X-Sequence-Number: 26893 "Tom Lane" writes: > Decibel! writes: >> I'm finding this rather interesting report from top on a Debian box... > >> Mem: 32945280k total, 32871832k used, 73448k free, 247432k buffers >> Swap: 1951888k total, 42308k used, 1909580k free, 30294300k cached > >> So how is it that linux thinks that 30G is cached? > > Why would you think that a number reported by the operating system has > something to do with Postgres' shared memory? I think his question is how can the kernel be using 30G for kernel buffers if it only has 32G total and 8G of that is taken up by Postgres's shared buffers. It seems to imply Linux is paging out sysV shared memory. In fact some of Heikki's tests here showed that Linux would do precisely that. If your working set really is smaller than shared buffers then that's not so bad. Those buffers really would be completely idle anyways. But if your working set is larger than shared buffers and you're just not thrashing it hard enough to keep it in RAM then it's really bad. The buffer Linux will choose to page out are precisely those that Postgres will likely choose shortly as victim buffers, forcing Linux to page them back in just so Postgres can overwrite them. -- Gregory Stark EnterpriseDB http://www.enterprisedb.com