Re: [Slony1-general] Mem usage/leak - advice needed

From: Ian Burrell <ianburrell(at)gmail(dot)com>
To: John Sidney-Woollett <johnsw(at)wardbrook(dot)com>
Cc: PostgreSQL general <pgsql-general(at)postgresql(dot)org>, Slony-I Mailing List <slony1-general(at)gborg(dot)postgresql(dot)org>
Subject: Re: [Slony1-general] Mem usage/leak - advice needed
Date: 2005-12-22 18:44:28
Message-ID: d91f09cd0512221044p53d7c6e2h5cd5cb24e5c2dd14@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 12/22/05, John Sidney-Woollett <johnsw(at)wardbrook(dot)com> wrote:
> In trying to investigate a possible memory issue that affects only one
> of our servers, I have been logging the process list for postgres
> related items 4 times a day for the past few days.
>
> This server uses postgres 7.4.6 + slon 1.1.0 on Debian i686 (Linux
> server2 2.6.8.1-4-686-smp) and is a slon slave in a two server
> replicated cluster. Our master DB (similar setup) does not exbibit this
> problem at all - only the subscriber node...
>
> The load average starts to go mental once the machine has to start
> swapping (ie starts running out of physical RAM). The solution so far is
> to stop and restart both slon and postgres and things return to normal
> for another 2 weeks.
>
> I know other people have reported similar things but there doesn't seem
> to be an explanation or solution (other than stopping and starting the
> two processes).
>
> Can anyone suggest what else to look at on the server to see what might
> be going on?
>
> Appreciate any help or advice anyone can offer. I'm not a C programmer
> nor a unix sysadmin, so any advice needs to be simple to understand.
>

The memory usage growth is caused by the buffers in the slave slon
daemon growing when long rows go through them. The buffers never
shrink while the slon daemon is running. How big is the largest rows
which slon replicates?

One suggestion I have seen is to recompile slon to use fewer buffers.
Another is to set a ulimit for memory size to automatically kill the
slon daemons when they get too big. The watchdog will then restart
them. Alternatively, your strategy of restarting the slon daemons
each week will work (you don't need to restart postgres).

I came up with a patch which shrinks the buffers when they go above a
certain size. This doesn't fix the problem of lots of big rows
happening at once but it fixes the gradual growth.

- Ian

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David Rysdam 2005-12-22 18:48:10 Re: reading EXPLAIN output
Previous Message Tom Lane 2005-12-22 18:33:27 Re: Why is create function bringing down the Backend server?