On 8/14/09 11:00 AM, "Jeremy Carroll" <jeremy.carroll@xxxxxxxxxxxxxxxxxxxxx> 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? Resident includes Shared. Shared is shared. So you have to subtract it from all the processes to see what they use on their own. What you really want is RES-SHR, or some of the other columns available in top. Hit 'h' in top to get some help on the other columns available, and 'f' and 'o' manipulate them. In particular, you might find the "DATA" column useful. It is approximately RES-SHR-CODE > > 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 Lets just take the two above and pretend that they are the only postgres processes. The RAM used by each exclusively is RES-SHR. Or, close to nothing for these two, aside from the rounding error. The memory used by postgres for shared memory is the largest of all SHR columns for postgres columns. Or, about 7.9GB. So, postgres is using about 7.9GB for shared memory, and very little for anything else. In formula form, its close to SUM(RES) - SUM(SHR) + MAX(SHR). That doesn't cover everything, but is very close. See the other columns available in top. -- Sent via pgsql-performance mailing list (pgsql-performance@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance