From: | Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com> |
---|---|
To: | Jeremy Carroll <jeremy(dot)carroll(at)networkedinsights(dot)com> |
Cc: | "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org> |
Subject: | Re: Memory reporting on CentOS Linux |
Date: | 2009-08-14 20:21:42 |
Message-ID: | dcc563d10908141321w4c14d00fyd9a85f4265a0733d@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-performance |
On Fri, Aug 14, 2009 at 12:00 PM, Jeremy
Carroll<jeremy(dot)carroll(at)networkedinsights(dot)com> wrote:
> I am confused about what the OS is reporting for memory usage on CentOS 5.3
> Linux. Looking at the resident memory size of the processes. Looking at the
> resident size of all postgres processes, the system should be using around
> 30Gb of physical ram. I know that it states that it is using a lot of shared
> memory. My question is how to I determine how much physical RAM postgres is
> using at any point in time?
OK, take the first pg process, and write down its RES size. For all
the rest, write down RES-SHR for how much more it's using. Since they
use a lot of shared memory, and since you're showing something like
7.9G shared, I'm gonna guess that's the size of your shared_buffers.
With those numbers you should get something just over a shade of 7.9G
used, and most of that is shared_buffers. Also, a quick check is to
look at this number:
22825616k cached
which tells you how much memory the OS is using for cache, which is ~22G.
I note that you've got 2G swapped out, this might well be
shared_buffers or something you'd rather not have swapped out. Look
into setting your swappiness lower (5 or so should do) to stop the OS
from swapping so much out.
/sbin/sysctl -a|grep swappiness
vm.swappiness = 60
is the default. You can change it permanently by editing your
/etc/sysctl.conf file (or wherever it lives) and rebooting, or running
/sbin/sysctl -p to process the entries and make them stick this
session. My big servers run with swappiness of 1 with no problems.
>
> This server has 24Gb of ram, and is reporting that 23GB is free for use. See
> calculation below
>
> (Memory Total – Used) + (Buffers + Cached) = Free Memory
> (24675740 – 24105052) + (140312 + 22825616) = 23,536,616 or ~23 Gigabytes
>
>
> So if my server has 23Gb of ram that is free for use, why is postgres
> reporting resident sizes of 30GB? Shared memory is reporting the same
> values, so how is the OS reporting that only 1Gb of RAM is being used?
>
> Help?
>
> top - 12:43:41 up 2 days, 19:04, 2 users, load average: 4.99, 4.81, 4.33
> Tasks: 245 total, 4 running, 241 sleeping, 0 stopped, 0 zombie
> Cpu(s): 26.0%us, 0.0%sy, 0.0%ni, 73.9%id, 0.1%wa, 0.0%hi, 0.0%si,
> 0.0%st
> Mem: 24675740k total, 24105052k used, 570688k free, 140312k buffers
> Swap: 2097144k total, 272k used, 2096872k free, 22825616k cached
> ---------------------
> PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
> 19469 postgres 15 0 8324m 7.9g 7.9g S 0.0 33.7 0:54.30 postgres:
> writer process
> 29763 postgres 25 0 8329m 4.5g 4.5g R 99.8 19.0 24:53.02 postgres:
> niadmin database x.x.x.49(51136) UPDATE
> 29765 postgres 25 0 8329m 4.4g 4.4g R 99.8 18.8 24:42.77 postgres:
> niadmin database x.x.x.49(51138) UPDATE
> 31778 postgres 25 0 8329m 4.2g 4.2g R 99.5 17.8 17:56.95 postgres:
> niadmin database x.x.x.49(51288) UPDATE
> 31779 postgres 25 0 8329m 4.2g 4.2g R 99.1 17.8 17:59.62 postgres:
> niadmin database x.x.x.49(51289) UPDATE
> 31780 postgres 23 0 8329m 4.1g 4.1g R 100.1 17.5 17:52.53 postgres:
> niadmin database x.x.x.49(51290) UPDATE
> 19467 postgres 15 0 8320m 160m 160m S 0.0 0.7 0:00.24
> /opt/PostgreSQL/8.3/bin/postgres -D /opt/PostgreSQL/8.3/data
>
> 19470 postgres 15 0 8324m 2392 1880 S 0.0 0.0 0:01.72 postgres: wal
> writer process
--
When fascism comes to America, it will be intolerance sold as diversity.
From | Date | Subject | |
---|---|---|---|
Next Message | Scott Marlowe | 2009-08-14 20:23:14 | Re: Memory reporting on CentOS Linux |
Previous Message | Jeremy Carroll | 2009-08-14 20:20:58 | Re: Memory reporting on CentOS Linux |