Re: Used Memory

From: Jon Brisbin <jon(dot)brisbin(at)npcinternational(dot)com>
To: pgsql-performance(at)postgresql(dot)org
Subject: Re: Used Memory
Date: 2005-10-21 15:29:35
Message-ID: 20051021102935.5e4b7113@localhost
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Fri, 21 Oct 2005 03:40:47 -0000
"Christian Paul B. Cosinas" <cpc(at)cybees(dot)com> wrote:

>
> But after a number of access to the tables the memory is being used
> and it is not being free up. Actually after this access to the
> database and the server is just idle

I noticed this behavior on my SUSE linux box as well. I thought it was
a memory leak in something (I think there was an actual memory leak in
the kernel shared memory stuff, which I fixed by upgrading my kernel
to 2.6.13-ck8). It turns out that some file systems are better than
others when it comes to increasing the performance of I/O on Linux.
ReiserFS was what I put on originally and by the end of the day, the
box would be using all of it's available memory in caching inodes.

I kept rebooting and trying to get the memory usage to go down, but it
never did. All but 500MB of it was disk cache. I let my apps just run
and when the application server needed more memory, it reclaimed it from
the disk cache, so there weren't side effects to the fact that top and
free always reported full memory usage.

They tell me that this is a good thing, as it reduces disk I/O and
increases performance. That's all well and good, but it's entirely
unnecessary in our situation. Despite that, I can't turn it off because
my research into the issue has shown that kernel developers don't want
users to be able to turn off disk caching. There is a value
in /proc/sys/vm/vfs_cache_pressure that can be changed, which will
affect the propensity of the kernel to cache files in RAM (google it
to find the suggestions on what value to set it to), but there isn't a
setting to turn that off on purpose.

After rolling my own CK-based kernel, switching to XFS, and tweaking
the nice and CPU affinity of my database process (I use schedtool in my
CK kernel to run it at SCHED_FIFO, nice -15, and CPU affinity confined
to the second processor in my dual Xeon eServer) has got me to the
point that the perpetually high memory usage doesn't affect my
application server.

Hope any of this helps.

Jon Brisbin
Webmaster
NPC International, Inc.

In response to

  • Used Memory at 2005-10-21 03:40:47 from Christian Paul B. Cosinas

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Alex Turner 2005-10-21 15:41:34 Re: Used Memory
Previous Message Alex Turner 2005-10-21 15:19:10 Re: What gets cached?