Re: shared_buffers vs Linux file cache

From: Roman Konoval <rkonoval(at)gmail(dot)com>
To: Huan Ruan <huan(dot)ruan(dot)it(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Jeff Janes <jeff(dot)janes(at)gmail(dot)com>, "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org>
Subject: Re: shared_buffers vs Linux file cache
Date: 2015-01-16 07:49:01
Message-ID: CABcZEEAa_DQr458OSdyeYFJV+cpXvmhwaW9D9_+E5uPaSB1qgg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Huan,

Residential memory is part of the process memory that is now swapped and is
in RAM. This includes also memory shared with other processes so sum of RES
for all processes may be greater that total physical memory.

I recommend this article
http://www.depesz.com/2012/06/09/how-much-ram-is-postgresql-using/ to get
better understanding how linux manages memory.

Regards,
Roman

On Fri, Jan 16, 2015 at 5:32 AM, Huan Ruan <huan(dot)ruan(dot)it(at)gmail(dot)com> wrote:

> Thanks very much, Glyn, Jeff, and Tom. That was very clearly explained.
>
> A related case, see the following top dump. The Postgres process is using
> 87g residential memory, which I thought was the physical memory consumed by
> a process that can't be shared with others. While, the free+cached is about
> 155gb. But, (87 + 155) is bigger than the total available 198g RAM. Does
> this mean some of the residential memory used by Postgres is actually
> shareable to others?
>
>
> >> Mem: 198311880k total, 183836408k used, 14475472k free, 8388k buffers
> >> Swap: 4194300k total, 314284k used, 3880016k free, 141105408k cached
> >>
> >> PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
> >> 15338 postgres 20 0 97.9g 87g 87g S 0.3 46.4 21:47.44
> >> postgres: checkpointer process
> >> 27473 postgres 20 0 98.1g 29g 29g S 0.0 15.8 2:14.93
> >> postgres: xxxx idle
> >> 4710 postgres 20 0 98.1g 24g 23g S 0.0 12.7 1:17.41
> >> postgres: xxxx idle
>
> >> 26587 postgres 20 0 98.0g 15g 15g S 0.0 8.0 1:21.24
>
>
>>
>>
>
>
>

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Laurent Cathala 2015-01-22 16:46:12 Initial insert
Previous Message Josh Berkus 2015-01-16 04:15:46 Re: Strange choice of general index over partial index