From: | Greg Smith <gsmith(at)gregsmith(dot)com> |
---|---|
To: | Matthew Pulis <mpulis(at)gmail(dot)com> |
Cc: | pgsql-admin(at)postgresql(dot)org, pgsql-general(at)postgresql(dot)org |
Subject: | Re: [GENERAL] PostgreSQL Cache |
Date: | 2008-09-29 06:55:52 |
Message-ID: | Pine.GSO.4.64.0809290237330.18983@westnet.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin pgsql-general |
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(at)gregsmith(dot)com http://www.gregsmith.com Baltimore, MD
From | Date | Subject | |
---|---|---|---|
Next Message | Joris Dobbelsteen | 2008-09-29 07:01:12 | Re: [GENERAL] PostgreSQL Cache |
Previous Message | Matthew Pulis | 2008-09-29 04:43:52 | PostgreSQL Cache |
From | Date | Subject | |
---|---|---|---|
Next Message | Joris Dobbelsteen | 2008-09-29 07:01:12 | Re: [GENERAL] PostgreSQL Cache |
Previous Message | Abdul Rahman | 2008-09-29 05:03:43 | Replication using slony-I |