Re: Creating a function for exposing memory usage of backend process

From: Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, torikoshia <torikoshia(at)oss(dot)nttdata(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Robert Haas <robertmhaas(at)gmail(dot)com>, Kasahara Tatsuhito <kasahara(dot)tatsuhito(at)gmail(dot)com>
Subject: Re: Creating a function for exposing memory usage of backend process
Date: 2020-08-20 02:17:58
Message-ID: d97ad430-444d-9ec8-21dd-a1584569309b@oss.nttdata.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2020/08/20 10:43, Andres Freund wrote:
> Hi,
>
> On 2020-08-19 21:29:06 -0400, Tom Lane wrote:
>> Andres Freund <andres(at)anarazel(dot)de> writes:
>>> On 2020-08-19 11:01:37 -0400, Tom Lane wrote:
>>>> I agree with that, but I think this patch has a bigger problem:
>>>> why bother at all? It seems like a waste of code space and future
>>>> maintenance effort, because there is no use-case.
>>
>>> I don't agree with this at all. I think there's plenty use cases. It's
>>> e.g. very common to try to figure out why the memory usage of a process
>>> is high. Is it memory not returned to the OS? Is it caches that have
>>> grown too much etc.
>>
>> Oh, I agree completely that there are lots of use-cases for finding
>> out what a process' memory map looks like. But this patch fails to
>> address any of them in a usable way.
>
> Even just being able to see the memory usage in a queryable way is a
> huge benefit.

+1

> The difference over having to parse the log, then parse
> the memory usage dump, and then aggregate the data in there in a
> meaningful way is *huge*. We've been slacking around lowering our
> memory usage, and I think the fact that it's annoying to analyze is a
> partial reason for that.

Agreed.


> I totally agree that it's not *enough*, but in contrast to you I think
> it's a good step. Subsequently we should add a way to get any backends
> memory usage.
> It's not too hard to imagine how to serialize it in a way that can be
> easily deserialized by another backend. I am imagining something like
> sending a procsignal that triggers (probably at CFR() time) a backend to
> write its own memory usage into pg_memusage/<pid> or something roughly
> like that.

Sounds good. Maybe we can also provide the SQL-callable function
or view to read pg_memusage/<pid>, to make the analysis easier.

Regards,

--
Fujii Masao
Advanced Computing Technology Center
Research and Development Headquarters
NTT DATA CORPORATION

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Smith 2020-08-20 02:18:25 Re: extension patch of CREATE OR REPLACE TRIGGER
Previous Message Fujii Masao 2020-08-20 02:09:42 Re: Creating a function for exposing memory usage of backend process