Re: about memory size reported by system. - Mailing list pgsql-general

From Scott Marlowe
Subject Re: about memory size reported by system.
Date
Msg-id AANLkTi=97Btquwkx0Efr-jhTSGqUyAi0QOWjVjMVwZms@mail.gmail.com
Whole thread Raw
In response to about memory size reported by system.  ("Edmundo Robles L." <erobles@sensacd.com.mx>)
List pgsql-general
On Wed, Mar 9, 2011 at 9:42 AM, Edmundo Robles L.
<erobles@sensacd.com.mx> wrote:
> Hi everyone!
>
> I have a doubt about  the memory consumed by  each connection open.
>
> suddenly my server, running postgres 8.3.11,  began to run   too slowly.
>
> Checking the  process with: ps -adelfo pcpu,vsz,args | more
>
> The processes,related to the connection to the db, each one  have a consume of memory near to the 50Mb. by the way i
have50 connections to the db, so i have a reported  memory consumed of 2.5M, when i have only 1G in the server. 
>
> If  I modify the shared_buffers value,  the report of  memory consumed  is according  with  shared buffers value.

The most likely explanation is that you're misinterpreting the restuls
of your ps output.   Vsize is virtual size which includes all libs
linked whether loaded or not and the amount of shared memory the
process is touching.  For instance, here's the output of top on my
machine running postgres at work:

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
14037 dgish     20   0 4259m 455m 445m R   98  0.4  31:16.24 postgres
32318 dgish     20   0 4260m 2.0g 1.9g R   98  1.6   0:08.59 postgres
32464 dgish     20   0 4263m 1.4g 1.4g R   91  1.2   0:06.96 postgres
 2150 dgish     20   0 4254m 227m 220m S   86  0.2   0:01.94 postgres
  866 dgish     20   0 4270m 1.5g 1.4g S   50  1.2   0:08.46 postgres
29930 dgish     20   0 4263m 1.6g 1.6g R   34  1.3   0:15.99 postgres
  888 dgish     20   0 4259m 239m 230m S   33  0.2   0:02.01 postgres

Note that virt is a tad over 4G.  Can you guess what my shared_buffers
are set to?  Yep, 4G.  Each process is aware of all the
shared_buffers.  Actual resident / in use memory ranges from 455M to
2G, but we subtract the shared memory it's using right now for
shared_buffers and we get a delta, which is in the 100Meg or less
range.  So each individual backend is using < !00Meg (good thing I've
got several huindred of them).

pgsql-general by date:

Previous
From: Dmitriy Igrishin
Date:
Subject: Re: Why length(to_char(1::integer, '9')) = 2 ?
Next
From: Adrian Klaver
Date:
Subject: Re: How to configure for remote TCP/IP client conncections using MS Visual Basic OLE DB calls and PostgreSQL dll's?