From mpulis@gmail.com Mon Sep 29 04:43:58 2008 Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 13F2D37BABB for ; Mon, 29 Sep 2008 01:43:58 -0300 (ADT) Received: from postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 33038-05 for ; Mon, 29 Sep 2008 01:43:54 -0300 (ADT) 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.152]) by postgresql.org (Postfix) with ESMTP id 9F56837BA27 for ; Mon, 29 Sep 2008 01:43:54 -0300 (ADT) Received: by fg-out-1718.google.com with SMTP id 16so1932029fgg.23 for ; Sun, 28 Sep 2008 21:43:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:mime-version:content-type; bh=ysAgDX8ahJ2AhcmQEVLh5miUpUtQIrYH6pJuutDFsj8=; b=m8h3O8JRRFl09TekQlwGLnYPOWyH4kZTbfLJ0u3APS2U2ts5EQ+2DshGbqmApHCIu5 XvpsCke+SeAFT66zfClXxF204L46mYnxLW9X5PDyqYmpuKXhhrUKx/uAgKo00ucsMhOW BbhBLNQ25sdV3hEsVxWFgEyDaTJv9sEr9Ic48= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type; b=Wm8gNHkdxZNMmfeumc6xPEM3KlqyUwwrQMAOX8aXjH7bsSJWSO13yFv7iWOBt3SUk+ HTEbOY+7EKM65cPtdVIhvZjI1ByblYoSxN7yNZjMDWG+iq5cSD/4UKE7yWMn50H8hkUp 7cPidd8wYctScGCpLswd5z6/OPjtAwupKAHLo= Received: by 10.187.237.12 with SMTP id o12mr512693far.56.1222663432440; Sun, 28 Sep 2008 21:43:52 -0700 (PDT) Received: by 10.187.180.16 with HTTP; Sun, 28 Sep 2008 21:43:52 -0700 (PDT) Message-ID: Date: Mon, 29 Sep 2008 06:43:52 +0200 From: "Matthew Pulis" To: pgsql-admin@postgresql.org, pgsql-general@postgresql.org Subject: PostgreSQL Cache MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_57703_30188044.1222663432437" X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.001 tagged_above=0 required=5 tests=HTML_MESSAGE=0.001 X-Spam-Level: X-Archive-Number: 200809/323 X-Sequence-Number: 30416 ------=_Part_57703_30188044.1222663432437 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi, I need to perform some timed testing, thus need to make sure that disk cache does not affect me. Is clearing the OS (Ubuntu) disk cache, ( by running: sudo echo 3 | sudo tee /proc/sys/vm/drop_caches ) enough to do this? If not can you please point me to some site please since all I am finding is such command. Thanks and regards Matthew -- Matthew Pulis URL : http://www.solutions-lab.net MSN : pulis_matthew[@]hotmail.com ICQ : 145951110 Skype : solutions-lab.net ------=_Part_57703_30188044.1222663432437 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline
Hi,

I need to perform some timed testing, thus need to make sure that disk cache does not affect me. Is clearing the OS (Ubuntu) disk cache, ( by running:  sudo echo 3 | sudo tee /proc/sys/vm/drop_caches ) enough to do this? If not can you please point me to some site please since all I am finding is such command.

Thanks and regards

Matthew

--
Matthew Pulis
URL : http://www.solutions-lab.net
MSN : pulis_matthew[@]hotmail.com
ICQ : 145951110
Skype : solutions-lab.net
------=_Part_57703_30188044.1222663432437-- From gsmith@gregsmith.com Mon Sep 29 06:55:58 2008 Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id A532837BA4E; Mon, 29 Sep 2008 03:55:58 -0300 (ADT) Received: from postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 55479-08; Mon, 29 Sep 2008 03:55:55 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from westnet.com (westnet.com [216.187.52.2]) by postgresql.org (Postfix) with ESMTP id 0943237BA30; Mon, 29 Sep 2008 03:55:54 -0300 (ADT) Received: from westnet.com (localhost [127.0.0.1]) by westnet.com (8.14.0/8.14.0) with ESMTP id m8T6tqfo020831; Mon, 29 Sep 2008 02:55:52 -0400 (EDT) Received: from localhost (gsmith@localhost) by westnet.com (8.14.0/8.13.2/Submit) with ESMTP id m8T6tqLM020828; Mon, 29 Sep 2008 02:55:52 -0400 (EDT) X-Authentication-Warning: westnet.com: gsmith owned process doing -bs Date: Mon, 29 Sep 2008 02:55:52 -0400 (EDT) From: Greg Smith X-X-Sender: gsmith@westnet.com To: Matthew Pulis cc: pgsql-admin@postgresql.org, pgsql-general@postgresql.org Subject: Re: [GENERAL] PostgreSQL Cache In-Reply-To: Message-ID: References: MIME-Version: 1.0 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: 200809/324 X-Sequence-Number: 30417 On Mon, 29 Sep 2008, Matthew Pulis wrote: > I need to perform some timed testing, thus need to make sure that disk cache > does not affect me. Is clearing the OS (Ubuntu) disk cache, ( by running: > sudo echo 3 | sudo tee /proc/sys/vm/drop_caches ) enough to do this? What you should do is: 1) Shutdown the database server (pg_ctl, sudo service postgresql stop, etc.) 2) sync 3) sudo echo 3 > /proc/sys/vm/drop_caches 4) Start the database server That will clear both the database and OS cache with a minimum of junk left behind in the process; clearing the cache without a sync is a bad idea. Note that all of this will still leave behind whatever cache is in your disk controller card or on the disk themselves available. There are some other techniques you could consider. Add a setp 2.5 that generates a bunch of data unused by the test, then sync again, and you've turned most of that into useless caching. Ideally, your test should be running against a large enough data set that the dozens or couple of hundred megabytes that might be in those will only add a bit of noise to whatever you're testing. If you're not running a larger test or going through tasts to make the caches clear, the only easy way to make things more clear is to reboot the whole server. -- * Greg Smith gsmith@gregsmith.com http://www.gregsmith.com Baltimore, MD From joris@familiedobbelsteen.nl Mon Sep 29 07:02:03 2008 Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id B04F637BEB5; Mon, 29 Sep 2008 04:02:03 -0300 (ADT) Received: from postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 56866-09; Mon, 29 Sep 2008 04:01:59 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from smtp-out1.tiscali.nl (smtp-out1.tiscali.nl [195.241.79.176]) by postgresql.org (Postfix) with ESMTP id 3B94D37BD93; Mon, 29 Sep 2008 04:01:58 -0300 (ADT) Received: from [195.240.247.225] (helo=mx1.joris2k.local) by smtp-out1.tiscali.nl with esmtp id 1KkClY-0007Na-Pk; Mon, 29 Sep 2008 09:01:56 +0200 Received: from localhost (localhost [127.0.0.1]) by mx1.joris2k.local (Postfix) with ESMTP id 941704008D; Mon, 29 Sep 2008 09:03:16 +0200 (CEST) X-Virus-Scanned: E-mail scanned by amavisd-new at familiedobbelsteen.nl (mx1.joris2k.local) Received: from mx1.joris2k.local ([127.0.0.1]) by localhost (mx1.joris2k.local [127.0.0.1]) (amavisd-new, port 10024) with LMTP id NteXknW8EI6A; Mon, 29 Sep 2008 09:02:57 +0200 (CEST) Received: from exchange1.joris2k.local (exchange1.joris2k.local [192.168.10.45]) by mx1.joris2k.local (Postfix) with ESMTP id D3AFB40087; Mon, 29 Sep 2008 09:02:57 +0200 (CEST) Received: from [192.168.10.241] ([192.168.10.241] RDNS failed) by exchange1.joris2k.local over TLS secured channel with Microsoft SMTPSVC(6.0.3790.3959); Mon, 29 Sep 2008 08:01:35 +0100 Message-ID: <48E07D38.90906@familiedobbelsteen.nl> Date: Mon, 29 Sep 2008 09:01:12 +0200 From: Joris Dobbelsteen User-Agent: Thunderbird 2.0.0.17 (X11/20080925) MIME-Version: 1.0 To: Matthew Pulis CC: pgsql-admin@postgresql.org, pgsql-general@postgresql.org Subject: Re: [GENERAL] PostgreSQL Cache References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 29 Sep 2008 07:01:35.0542 (UTC) FILETIME=[36242560:01C92201] 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: 200809/325 X-Sequence-Number: 30418 Matthew Pulis wrote: > Hi, > > I need to perform some timed testing, thus need to make sure that disk > cache does not affect me. Is clearing the OS (Ubuntu) disk cache, ( by > running: sudo echo 3 | sudo tee /proc/sys/vm/drop_caches ) enough to > do this? If not can you please point me to some site please since all > I am finding is such command. Look for methodologies for doing performance tests. A problem is that the disk cache is an essential part that makes up for postgresql performance. Also do not forget about overhead and inaccuracies that you will affect your results. In general performance tests are a rather large simulation of how your application would use the database. It should be large enough for many effects (such as initial cache state) to be neglected. It only provides an average for the performance on your system configuration. If you run it a few times more, you can compute the variation. It provides some insight how stable your system is in handling the workload. - Joris From oleg@sai.msu.su Mon Sep 29 07:52:10 2008 Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id D577837BCD7; Mon, 29 Sep 2008 04:52:10 -0300 (ADT) Received: from postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 65637-03-4; Mon, 29 Sep 2008 04:52:03 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sn.sai.msu.ru (sn.sai.msu.ru [195.208.220.215]) by postgresql.org (Postfix) with ESMTP id 02AC137BA4E; Mon, 29 Sep 2008 04:52:02 -0300 (ADT) Received: from sn.sai.msu.ru (localhost [127.0.0.1]) by sn.sai.msu.ru (8.14.1/8.12.8) with ESMTP id m8T7pq9J003238; Mon, 29 Sep 2008 11:51:52 +0400 Received: from localhost (megera@localhost) by sn.sai.msu.ru (8.14.1/8.12.8/Submit) with ESMTP id m8T7pqL8003235; Mon, 29 Sep 2008 11:51:52 +0400 X-Authentication-Warning: sn.sai.msu.ru: megera owned process doing -bs Date: Mon, 29 Sep 2008 11:51:52 +0400 (MSD) From: Oleg Bartunov X-X-Sender: megera@sn.sai.msu.ru To: Greg Smith cc: Matthew Pulis , pgsql-admin@postgresql.org, pgsql-general@postgresql.org Subject: Re: [GENERAL] PostgreSQL Cache In-Reply-To: Message-ID: References: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=1.125 tagged_above=0 required=5 tests=DNS_FROM_RFC_BOGUSMX=2.125, RCVD_IN_DNSWL_LOW=-1 X-Spam-Level: * X-Archive-Number: 200809/326 X-Sequence-Number: 30419 A while ago I wrote a script based on Dave Plonka work http://net.doit.wisc.edu/~plonka/fincore/ My script monitors system buffers and shared buffers (if pg_buffercache installed) and I found it's almost useless to check system buffers, since I got rather ridiculous numbers. > I use it to investigate OS cacheing of PostgreSQL files and was > surprized on 24 Gb server, total cache was about 30 Gb. How this is > possible ? I can send script and perl module if you want to play with. Oleg On Mon, 29 Sep 2008, Greg Smith wrote: > On Mon, 29 Sep 2008, Matthew Pulis wrote: > >> I need to perform some timed testing, thus need to make sure that disk >> cache >> does not affect me. Is clearing the OS (Ubuntu) disk cache, ( by running: >> sudo echo 3 | sudo tee /proc/sys/vm/drop_caches ) enough to do this? > > What you should do is: > > 1) Shutdown the database server (pg_ctl, sudo service postgresql stop, etc.) > 2) sync > 3) sudo echo 3 > /proc/sys/vm/drop_caches > 4) Start the database server > > That will clear both the database and OS cache with a minimum of junk left > behind in the process; clearing the cache without a sync is a bad idea. > > Note that all of this will still leave behind whatever cache is in your disk > controller card or on the disk themselves available. There are some other > techniques you could consider. Add a setp 2.5 that generates a bunch of data > unused by the test, then sync again, and you've turned most of that into > useless caching. > > Ideally, your test should be running against a large enough data set that the > dozens or couple of hundred megabytes that might be in those will only add a > bit of noise to whatever you're testing. If you're not running a larger test > or going through tasts to make the caches clear, the only easy way to make > things more clear is to reboot the whole server. > > -- > * Greg Smith gsmith@gregsmith.com http://www.gregsmith.com Baltimore, MD > > Regards, Oleg _____________________________________________________________ Oleg Bartunov, Research Scientist, Head of AstroNet (www.astronet.ru), Sternberg Astronomical Institute, Moscow University, Russia Internet: oleg@sai.msu.su, http://www.sai.msu.su/~megera/ phone: +007(495)939-16-83, +007(495)939-23-83 From sam@samason.me.uk Mon Sep 29 11:26:42 2008 Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 9EB9337BABB for ; Mon, 29 Sep 2008 08:26:42 -0300 (ADT) Received: from postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 15867-04 for ; Mon, 29 Sep 2008 08:26:38 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from frubble.xen.chris-lamb.co.uk (frubble.xen.chris-lamb.co.uk [89.16.166.12]) by postgresql.org (Postfix) with ESMTP id 2E64737BA4E for ; Mon, 29 Sep 2008 08:26:39 -0300 (ADT) Received: from sam by frubble.xen.chris-lamb.co.uk with local (Exim 4.63) (envelope-from ) id 1KkGte-0005Pa-LD for pgsql-general@postgresql.org; Mon, 29 Sep 2008 12:26:34 +0100 Date: Mon, 29 Sep 2008 12:26:34 +0100 From: Sam Mason To: pgsql-general@postgresql.org Subject: Re: PostgreSQL Cache Message-ID: <20080929112634.GM7271@frubble.xen.chris-lamb.co.uk> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.13 (2006-08-11) 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: 200809/1129 X-Sequence-Number: 138136 On Mon, Sep 29, 2008 at 02:55:52AM -0400, Greg Smith wrote: > On Mon, 29 Sep 2008, Matthew Pulis wrote: > >I need to perform some timed testing, thus need to make sure that > >disk cache does not affect me. Is clearing the OS (Ubuntu) disk > >cache, (by running: sudo echo 3 | sudo tee /proc/sys/vm/drop_caches) > >enough to do this? > > 3) sudo echo 3 > /proc/sys/vm/drop_caches I'm not sure about the rest, but shouldn't this be: echo 3 | sudo tee /proc/sys/vm/drop_caches the OP's "sudo echo 3" seems redundant; "echo" doesn't need to be run with higher privileges, only the writing process needs that. As an aside, it would be nicer if there was a more appropriately program than tee but I've yet to find one. Sam From gsmith@gregsmith.com Mon Sep 29 21:53:07 2008 Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 3185B37C07A for ; Mon, 29 Sep 2008 18:53:07 -0300 (ADT) Received: from postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 56097-02 for ; Mon, 29 Sep 2008 18:53:04 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from westnet.com (westnet.com [216.187.52.2]) by postgresql.org (Postfix) with ESMTP id 6CD2537C078 for ; Mon, 29 Sep 2008 18:53:04 -0300 (ADT) Received: from westnet.com (localhost [127.0.0.1]) by westnet.com (8.14.0/8.14.0) with ESMTP id m8TLr2f0027454; Mon, 29 Sep 2008 17:53:02 -0400 (EDT) Received: from localhost (gsmith@localhost) by westnet.com (8.14.0/8.13.2/Submit) with ESMTP id m8TLr2tO027451; Mon, 29 Sep 2008 17:53:02 -0400 (EDT) X-Authentication-Warning: westnet.com: gsmith owned process doing -bs Date: Mon, 29 Sep 2008 17:53:02 -0400 (EDT) From: Greg Smith X-X-Sender: gsmith@westnet.com To: Sam Mason cc: pgsql-general@postgresql.org Subject: Re: PostgreSQL Cache In-Reply-To: <20080929112634.GM7271@frubble.xen.chris-lamb.co.uk> Message-ID: References: <20080929112634.GM7271@frubble.xen.chris-lamb.co.uk> MIME-Version: 1.0 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: 200809/1163 X-Sequence-Number: 138170 On Mon, 29 Sep 2008, Sam Mason wrote: > On Mon, Sep 29, 2008 at 02:55:52AM -0400, Greg Smith wrote: >> 3) sudo echo 3 > /proc/sys/vm/drop_caches > > I'm not sure about the rest, but shouldn't this be: > echo 3 | sudo tee /proc/sys/vm/drop_caches I couldn't think of any reason to actually include the tee in there and just optimized displaying the "3" out as script noise. > As an aside, it would be nicer if there was a more appropriately program > than tee but I've yet to find one. What are you trying to accomplish here that tee isn't quite right for? -- * Greg Smith gsmith@gregsmith.com http://www.gregsmith.com Baltimore, MD From sam@samason.me.uk Tue Sep 30 12:04:40 2008 Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 2219C37C6D1 for ; Tue, 30 Sep 2008 09:04:40 -0300 (ADT) Received: from postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 92918-08 for ; Tue, 30 Sep 2008 09:04:33 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from frubble.xen.chris-lamb.co.uk (frubble.xen.chris-lamb.co.uk [89.16.166.12]) by postgresql.org (Postfix) with ESMTP id C22CC37C369 for ; Tue, 30 Sep 2008 09:04:33 -0300 (ADT) Received: from sam by frubble.xen.chris-lamb.co.uk with local (Exim 4.63) (envelope-from ) id 1Kkdxt-0008AF-W2 for pgsql-general@postgresql.org; Tue, 30 Sep 2008 13:04:30 +0100 Date: Tue, 30 Sep 2008 13:04:29 +0100 From: Sam Mason To: pgsql-general@postgresql.org Subject: Re: PostgreSQL Cache Message-ID: <20080930120429.GN7271@frubble.xen.chris-lamb.co.uk> References: <20080929112634.GM7271@frubble.xen.chris-lamb.co.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.13 (2006-08-11) 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: 200809/1195 X-Sequence-Number: 138202 On Mon, Sep 29, 2008 at 05:53:02PM -0400, Greg Smith wrote: > On Mon, 29 Sep 2008, Sam Mason wrote: > > echo 3 | sudo tee /proc/sys/vm/drop_caches > >As an aside, it would be nicer if there was a more appropriate program > >than tee but I've yet to find one. > > What are you trying to accomplish here that tee isn't quite right for? tee works for how it's being used for here; it's just wired into my brain for tasks other than writing to files with different privileges. I ended up with a similar invocation when I was solving a similar problem a couple of months ago (not sure how I'd not hit it before then) and kept searching for something more natural. I've just done a search and using tee here appears to be somewhat standard, so I guess that answers my question. Sorry for the noise! Sam