Re: Used Memory - Mailing list pgsql-performance

From Craig A. James
Subject Re: Used Memory
Date
Msg-id 435D5654.2080209@modgraph-usa.com
Whole thread Raw
In response to Re: Used Memory  (Scott Marlowe <smarlowe@g2switchworks.com>)
Responses Re: Used Memory  ("Christian Paul B. Cosinas" <cpc@cybees.com>)
List pgsql-performance
Scott Marlowe wrote:
>>What's needed is a way for the application developer to explicitely say,
>> "This object is frequenly used, and I want it kept in memory."
>
> There's an interesting conversation happening on the linux kernel
> hackers mailing list right about now that applies:
>
> http://www.gossamer-threads.com/lists/linux/kernel/580789

Thanks for the pointer.  If you're a participant in that mailing list, maybe you could forward this comment...

A fundamental flaw in the kernel, which goes WAY back to early UNIX implementations, is that the nice(1) setting of a
programonly applies to CPU usage, not to other resources.  In this case, the file-system cache has no priority, so even
ifI set postmaster's nice(1) value to a very high priority, any pissant process with the lowest priority possible can
comealong with a "cat some-big-file >/dev/null" and trash my cached file-system pages.  It's essentially a
denial-of-servicemechanism that's built in to the kernel. 

The kernel group's discussion on the heuristics of how and when to toss stale cache pages should have a strong nice(1)
componentto it.  A process with a low priority should not be allowed to toss memory from a higher-priority process
unlessthere is no other source of memory. 

Getting back to Postgres, the same points that the linux kernel group are discussing apply to Postgres.  There is
simplyno way to devise a heuristic that comes even close to what the app developer can tell you.  A mechanism that
allowedan application to say, "Keep this table in memory" is the only way.  App developers should be advised to use it
sparingly,because most of the time the system is pretty good at memory management, and such a mechanism hobbles the
system'sability to manage.  But when it's needed, there is no substitute. 

Craig


pgsql-performance by date:

Previous
From: Scott Marlowe
Date:
Subject: Re: Used Memory
Next
From: "Craig A. James"
Date:
Subject: Re: Is There Any Way ....