[nycbug-talk] postgres memory question
Jonathan Vanasco
nycbug-list at 2xlp.com
Thu Sep 7 14:41:05 EDT 2006
the other day i noticed what might be a memory leak in PG on my
FreeBSD 6.0 REL box ( it could be in Apache/ModPerl/DBI , but some
bad command line tests point to pg. I'm hoping someone here can help
me figure out what is at blame )
someone else running modperl with pg on RHEL posted a problem like
this a few weeks ago, so I think there might be more to it...
anyways, here's the issue:
i start my box up, ONLY running apache/pg ( nothing else is on ), and
I have ~900 MB free. Perfect.
I make some requests, Apache and PG consume memory. Expected.
I restart Apache, it releases memory and the associated pg_client .
PG still holds shared memory. Expected.
I start stressing Apache ( 10k-50k requests )- apache works great.
not visible memory issues. MaxChildRequests keeps size manageble.
I stop apache, it releases memory and the associated pg_client
memory. PG still holds shared memory. Expected.
I stop the postmaster daemon. PG releases the lock on shared memory
( ipcs shows it ). I expect to see 900 MB free. Instead i see 700.
When I noticed this first, I was swapping. The first person who
experienced something like this was swapping like mad as well.
I run this again a few times, I inch closer and closer to 0. Except
its hard to get the free mem down to 0 - it takes a while.
I'm hoping some people here might be able to suggest the following:
a- A pure PG way to max out shared memory in clients, and restart,
so I can tell if this behavior is from PG or Apache/ModPerl. I
*think* its from PG, as start/stop a few pg clients and then stop/
start the daemon i see a decrease in memory.
I was trying to think of some sort of recursive select or
exponential algorithm. I couldn't find anything on google though.
b- A way to better examine free memory. My knowledge is limited to
top / and a little bit of libgtop. I know i was swapping because top
reported it as such. But I've been told that top doesn't always
report truly 'free' memory-- once that hits 0 it looks in buffers/
cached. So maybe the pg memory is there? I dunno.
If anyone has a clue, I'd be appreciative. This isn't an issue as
long as I don't stop/start postgres.
More information about the talk
mailing list