Re: PostreSQL v9.2 uses a lot of memory in Windows XP

From: Wu Ming <rdyf4ever(at)gmail(dot)com>
To: Craig Ringer <craig(at)2ndquadrant(dot)com>
Cc: "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org>
Subject: Re: PostreSQL v9.2 uses a lot of memory in Windows XP
Date: 2012-11-14 05:56:17
Message-ID: CAE5Kd6LM2wrzTVhtYvZrDdU=qXjjesVf7d2wDDbZtMEQCrvXHQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Hi,

> As I said, it just isn't that simple when shared memory is involved. A
> rough measure for PostgreSQL is the "virtual size" of one of the
> processes, plus the working sets of all the others. Alternately, you can
> reasonably estimate the memory consumption by adding all the working
> sets and then adding the value of shared_buffers to that - this will
> under-estimate usage slightly because PostgreSQL also uses shared memory
> for other things, but not tons of it in a normal configuration.

This is interesting. About the "virtual size of one of the process",
which process I should look up? Is the one who has the biggest virtual
size?

http://i45.tinypic.com/vr4t3b.png

For example, from the above screenshot, the biggest virtual size from
all postgresql process is 740004. So can we said the total approximate
of memory usage of the postgresql service is 740004 K +
total_of_working_sets (4844 K + 10056 K + 5408 K + 6020 K + ...) ?

> Sure, that's what you see, but you should really be looking at the
> numbers. Swap in and out bytes, memory usage, etc. In Windows 7 or
> Win2k8 Server you'd use the Performance Monitor for that; I don't
> remember off the top of my head where to look in XP.

I had total paging file size = 3GB.

There is perfmon.exe in windows xp, but don't know how to use and
analyze the graph.

> I'd say your problem has nothing to do with PostgreSQL.

Maybe you're right. If I close one of the memory porks, it gets a bit
better. Maybe I was too quick to blame postgreSQL, it's just that I
can't close and restart other applications because they are either too
important or slow to reload, where postgresql service is very quick in
restarting. I hope it'll understand.

On Wed, Nov 14, 2012 at 6:07 AM, Craig Ringer <craig(at)2ndquadrant(dot)com> wrote:
> Please reply to the list, not directly to me. Comments follow in-line.
>
> On 11/13/2012 11:37 PM, Wu Ming wrote:
>> Hi,
>>
>> What column in Process Explorer to determine memory usage? Currently I
>> thought "Working Set" is the correct one.
> As I said, it just isn't that simple when shared memory is involved. A
> rough measure for PostgreSQL is the "virtual size" of one of the
> processes, plus the working sets of all the others. Alternately, you can
> reasonably estimate the memory consumption by adding all the working
> sets and then adding the value of shared_buffers to that - this will
> under-estimate usage slightly because PostgreSQL also uses shared memory
> for other things, but not tons of it in a normal configuration.
>> The 'lagging' is like when you try to alt+tab or activating/focusing
>> other application window, or changing tab in browser, it goes slow or
>> lagged in its UI loading.
> Sure, that's what you see, but you should really be looking at the
> numbers. Swap in and out bytes, memory usage, etc. In Windows 7 or
> Win2k8 Server you'd use the Performance Monitor for that; I don't
> remember off the top of my head where to look in XP.
>> My firefox has many tabs opened (around 30 tabs) and eclipse is well
>> known as its high memory usage.
> On a 2GB machine? Yup, that'll do it.
>
> You've shown a screenshot that suggests that Pg is using relatively
> little RAM, and you're running two known memory pigs. I'd say your
> problem has nothing to do with PostgreSQL.
>> Then usually I also opened opera and
>> chrome with ~10-20 tabs opened.
> Time to buy more RAM.
>> I saw that chrome also spawned many
>> process (I had 4 tabs opened, but it shows 8 child process). They
>> might be the big process that probably is the main cause of the
>> lagging.
> It's going to be everything adding up. Chrome, Eclipse, Firefox, all
> fighting for RAM.
>
> BTW, chrome uses a multi-process architecture like PostgreSQL, but
> unlike PostgreSQL it does not use shared memory, so you can tell how
> much RAM Chrome is using very easily by adding up the working sets.
>
> --
> Craig Ringer http://www.2ndQuadrant.com/
> PostgreSQL Development, 24x7 Support, Training & Services
>

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Craig Ringer 2012-11-14 06:47:36 Re: PostreSQL v9.2 uses a lot of memory in Windows XP
Previous Message Andrew Dunstan 2012-11-14 03:56:16 Re: [HACKERS] pg_dump and thousands of schemas