Re: How to clear linux file cache?

Lists: pgsql-general
From: Janning Vygen <vygen(at)gmx(dot)de>
To: pgsql-general(at)postgresql(dot)org
Subject: How to clear linux file cache?
Date: 2004-11-16 09:59:45
Message-ID: 200411161059.46156.vygen@gmx.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Hi,

i am testing a few queries in my postgresql DB. The first query after reboot
is always slower because of an empty OS page/file cache.

I want to test my queries without any files in the linux kernel cache, just to
know what would be the worst execution time. At the moment i stop postgresql
and do something like

find / -name foo

for a few minutes and start postgresql afterwards.

I search manuals with "apropos page cache" and found sync but it doesnt clear
the cache, just writes dirty pages back to disk. I googled for "linux clear
page cache" but did not found what i need. (of course i searched the
archives, too)

So how do i easily empty all page/file caches on linux (2.4.24)?

Sorry for beeing a little bit OT, but i think my question still relates to
postgresql.

kind regards,
janning


From: Doug McNaught <doug(at)mcnaught(dot)org>
To: Janning Vygen <vygen(at)gmx(dot)de>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: How to clear linux file cache?
Date: 2004-11-16 15:39:57
Message-ID: 87oehxssz6.fsf@asmodeus.mcnaught.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Janning Vygen <vygen(at)gmx(dot)de> writes:

> So how do i easily empty all page/file caches on linux (2.4.24)?

Probably the closest you can easily get is to put the Postgres data
files on their own partition, and unmount/remount that partition
before running yuour tests. Unmounting will sync and throw away all
cached file data for that partition.

-Doug


From: Christopher Browne <cbbrowne(at)acm(dot)org>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: How to clear linux file cache?
Date: 2004-11-16 15:50:58
Message-ID: m3fz39hjx9.fsf@knuth.knuth.cbbrowne.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

The world rejoiced as vygen(at)gmx(dot)de (Janning Vygen) wrote:
> So how do i easily empty all page/file caches on linux (2.4.24)?

You can empty them of PostgreSQL-related data by filling them with
something else.

You might head to some directory that has more data in it than you
have memory, and "cat" the files...
--
"cbbrowne","@","linuxfinances.info"
http://www.ntlug.org/~cbbrowne/sap.html
"As far as Saddam Hussein being a great military strategist, he is
neither a strategist, nor is he schooled in the operational arts, nor
is he a tactician, nor is he a general, nor is he as a soldier. Other
than that, he's a great military man, I want you to know that."
-- General Norman Schwarzkopf, 2/27/91


From: Janning Vygen <vygen(at)gmx(dot)de>
To: Doug McNaught <doug(at)mcnaught(dot)org>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: How to clear linux file cache?
Date: 2004-11-16 16:37:20
Message-ID: 200411161737.20569.vygen@gmx.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Am Dienstag, 16. November 2004 16:39 schrieb Doug McNaught:
> Janning Vygen <vygen(at)gmx(dot)de> writes:
> > So how do i easily empty all page/file caches on linux (2.4.24)?
>
> Probably the closest you can easily get is to put the Postgres data
> files on their own partition, and unmount/remount that partition
> before running yuour tests. Unmounting will sync and throw away all
> cached file data for that partition.

very good idea. i will do it like this.

thanks.
janning