Re: Postgres filling up hard drive with swap files - Mailing list pgsql-general

From Bill Moran
Subject Re: Postgres filling up hard drive with swap files
Date
Msg-id 20040820130218.41736683.wmoran@potentialtech.com
Whole thread Raw
In response to Re: Postgres filling up hard drive with swap files  (Joe Lester <joe_lester@sweetwater.com>)
List pgsql-general
Joe Lester <joe_lester@sweetwater.com> wrote:

> Thanks for the response!
>
> > Maybe you said this before, but I didn't follow the previous thread.
> > What do you mean by swap files?
>
> By swap files I mean the files that contain the memory that the OS is
> maintaining on the hard disk, after physical RAM has overflowed.
>
> > Where are those files located?
>
> I can see the swap files and watch them grow over time. They are
> located on my Mac OS 10.3.2 eMac at /var/vm/.
>
> > Can you show a listing of them?
>
> Right now there are not that many since I just restarted the server
> recently. But already, they total 3 GB.
>
> officelink:/var/vm root# ls -lh
> drwx--x--x  14 root  wheel       476B 17 Feb  2004 app_profile
> -rw------T   1 root  wheel        64M 31 Jul 09:10 swapfile0
> -rw------T   1 root  wheel        64M 31 Jul 15:13 swapfile1
> -rw------T   1 root  wheel       128M 31 Jul 16:08 swapfile2
> -rw------T   1 root  wheel       256M  3 Aug 13:20 swapfile3
> -rw------T   1 root  wheel       512M 18 Aug 14:29 swapfile4
> -rw------T   1 root  wheel       512M 18 Aug 16:24 swapfile5
> -rw------T   1 root  wheel       512M 18 Aug 23:30 swapfile6
> -rw------T   1 root  wheel       512M 19 Aug 12:59 swapfile7
> -rw------T   1 root  wheel       512M 20 Aug 09:56 swapfile8
>
> > I assume, of course, that your data proper does not grow linearly with
> > those "swap files," does it?
>
> The total amount of disk space consumed by the swap files vastly
> exceeds the size of my postgres data directory, if that's what you're
> asking, which is about 300 MB or so.

How many Postgres processes are running?  Does this number increase with
the memory usage.

Simple fact of the matter is that you have apparently found a memory
leak.  How Mac OS X deals with swapping is (more or less) unimportant.

I'm wondering, however, if you have a connection leak instead.  i.e.
is it possible that your client application is opening a whole bunch
of connections and never closing them?  You did show that you have
a max # of connection of 200.  That's pretty high, unless you've got
a lot of RAM in that machine.

A more accurate description of the problem would be:
How many connections are actually open?
How much memory is actually in use by Postgres processes?  (The amount of
swap in use is unimportant to the Postgres folks, it's an OS thing)

--
Bill Moran
Potential Technologies
http://www.potentialtech.com

pgsql-general by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: Postgres filling up hard drive with swap files
Next
From: "Peter Haworth"
Date:
Subject: Re: How to setup default value "0000-00-00" for "date"