Re: enhance pg_log_backend_memory_contexts() to log memory contexts of auxiliary processes

From: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>
To: torikoshia <torikoshia(at)oss(dot)nttdata(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: enhance pg_log_backend_memory_contexts() to log memory contexts of auxiliary processes
Date: 2021-10-29 16:55:04
Message-ID: CALj2ACUBuaj_REZgSF6QGV9STWPFmqQ9n54C7xuzSyY=Ymn-ag@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Oct 11, 2021 at 9:55 AM Bharath Rupireddy
<bharath(dot)rupireddyforpostgres(at)gmail(dot)com> wrote:
>
> On Mon, Oct 11, 2021 at 8:21 AM torikoshia <torikoshia(at)oss(dot)nttdata(dot)com> wrote:
> >
> > Thanks for working on this!
> >
> > On 2021-10-09 22:23, Bharath Rupireddy wrote:
> > > Hi,
> > >
> > > Currently pg_log_backend_memory_contexts() doesn't log the memory
> > > contexts of auxiliary processes such as bgwriter, checkpointer, wal
> > > writer, archiver, startup process and wal receiver. It will be useful
> > > to look at the memory contexts of these processes too, for debugging
> > > purposes and better understanding of the memory usage pattern of these
> > > processes.
> >
> > As the discussion below, we thought logging memory contexts of other
> > than client backends is possible but were not sure how useful it is.
> > After all, we have ended up restricting the target process to client
> > backends for now.
> >
> >
> > https://www.postgresql.org/message-id/0b0657d5febd0e46565a6bc9c62ba3f6%40oss.nttdata.com
> >
> > If we can use debuggers, it's possible to know the memory contexts e.g.
> > using MemoryContextStats().
> > So IMHO if it's necessary to know memory contexts without attaching gdb
> > for other than client backends(probably this means using under
> > production environment), this enhancement would be pay.
>
> Thanks for providing your thoughts. Knowing memory usage of auxiliary
> processes is as important as backends (user session processes) without
> attaching debugger in production environments.
>
> There are some open points as mentioned in my first mail in this
> thread, I will start working on this patch once we agree on them.

I'm attaching the v1 patch that enables
pg_log_backend_memory_contexts() to log memory contexts of auxiliary
processes. Please review it.

Here's the CF entry - https://commitfest.postgresql.org/35/3385/

Regards,
Bharath Rupireddy.

Attachment Content-Type Size
v1-0001-enhance-pg_log_backend_memory_contexts-to-log-mem.patch application/octet-stream 7.1 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Marcos Pegoraro 2021-10-29 17:00:18 Re: Modifying TOAST policy will not affect the way existing data is stored ?
Previous Message Tom Lane 2021-10-29 16:04:43 Re: Extension ownership and misuse of SET ROLE/SET SESSION AUTHORIZATION