Re: Memory usage of writer process

From: Scott Carey <scott(at)richrelevance(dot)com>
To: Alex <alex(at)liivid(dot)com>, "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Memory usage of writer process
Date: 2009-08-13 21:42:41
Message-ID: C6A9D6E1.EBFA%scott@richrelevance.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On 8/12/09 9:44 PM, "Alex" <alex(at)liivid(dot)com> wrote:

> The writer process seems to be using inordinate amounts of memory:
>
> PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+
> COMMAND
> 11088 postgres 13 -2 3217m 2.9g 2.9g S 0 38.7 0:10.46 postgres:
> writer process
> 20190 postgres 13 -2 3219m 71m 68m S 0 0.9 0:52.48 postgres:
> cribq cribq [local] idle
>
> I am writing moderately large (~3k) records to my database a few times
> a second. Even when I stop doing that, the process continues to take
> up all of that memory.
>
> Am I reading this right? Why is it using so much memory?
>

It is exclusively using the difference between the RES and SHR columns. So
... Less than ~50MB and likely much less than that (2.9g - 2.9g with
rounding error).

SHR is the shared memory the process has touched, and is shared amongst all
postgres processes. Typically, this maxes out at the value of your
shared_buffers setting.

Based on the above, I'd wager your shared_buffers setting is 3000MB.

If your writer process or any other process has a value for (RES - SHR) that
is very large, then be concerned. For example, the second postgres process
in the above top output is using about 3MB exclusively, but has touched
about 68MB of the shared space, and so it shows up as 68 + 3 = 71m in the
RES column. 3MB is not much so this is not a concern.

>
> --
> Sent via pgsql-performance mailing list (pgsql-performance(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-performance
>

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Alvaro Herrera 2009-08-13 21:58:04 Re: freezing tuples ( was: Why is vacuum_freeze_min_age 100m? )
Previous Message Jeff Davis 2009-08-13 21:33:00 freezing tuples ( was: Why is vacuum_freeze_min_age 100m? )