Re: Add tracking of backend memory allocated to pg_stat_activity

From: Reid Thompson <reid(dot)thompson(at)crunchydata(dot)com>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Cc: reid(dot)thompson(at)crunchydata(dot)com
Subject: Re: Add tracking of backend memory allocated to pg_stat_activity
Date: 2022-09-06 21:10:49
Message-ID: 0aba97ee26a46f76f11ce7708fbb2e553817afaa.camel@crunchydata.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, 2022-09-01 at 13:43 +0900, Kyotaro Horiguchi wrote:
>
> > @@ -916,6 +930,7 @@ AllocSetAlloc(MemoryContext context, Size size)
> >    return NULL;
> >  
> >    context->mem_allocated += blksize;
> > + pgstat_report_backend_mem_allocated_increase(blksi
> > ze);
>
> I'm not sure this is acceptable. The function adds a branch even when
> the feature is turned off, which I think may cause a certain extent
> of
> performance degradation. A past threads [1], [2] and [3] might be
> informative.

Stated above is '...even when the feature is turned off...', I want to
note that this feature/patch (for tracking memory allocated) doesn't
have an 'on/off'. Tracking would always occur.

I'm open to guidance on testing for performance degradation. I did
note some basic pgbench comparison numbers in the thread regarding
limiting backend memory allocations.

> --
> Kyotaro Horiguchi
> NTT Open Source Software Center

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2022-09-06 21:19:00 Re: HOT chain validation in verify_heapam()
Previous Message David Rowley 2022-09-06 20:59:56 Re: Fix possible bogus array out of bonds (src/backend/access/brin/brin_minmax_multi.c)