From: Tom Lane <tgl@sss.pgh.pa.us>
To: Michael Paquier <michael.paquier@gmail.com>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: Craig Ringer <craig@2ndquadrant.com>
Cc: Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp>
Cc: pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.org>
Subject: Re: Protect syscache from bloating with negative cache entries
Date: Fri, 13 Jan 2017 17:58:41 -0500
Message-ID: <30626.1484348321@sss.pgh.pa.us> (raw)
In-Reply-To: <CAB7nPqRgkyR9p-Lz75no+Dz=t6FeHpXA68LU6-sevKhzdvgTjg@mail.gmail.com>
References: <20161219.201505.11562604.horiguchi.kyotaro@lab.ntt.co.jp>
<CA+Tgmob_ksTOgmbXhno+k5XXPOK+-JYYLoU3MpXuutP4bH7gzA@mail.gmail.com>
<CAMsr+YHziSok-AM=krEQ+HaRQzst4+M1+2WGYqZw_i6w9vVBvA@mail.gmail.com>
<30868.1482246558@sss.pgh.pa.us>
<CA+TgmoaMPbN5vvH33zLK7MR+PiCYWPvTHmSSrDab4vurLOXS-Q@mail.gmail.com>
<23492.1482264621@sss.pgh.pa.us>
<CAB7nPqQABjAGDzTREuHOgJS3iHY6nVZ+Z2x1cL1JLKBLMpzXTg@mail.gmail.com>
<4647.1484315911@sss.pgh.pa.us>
<CA+TgmobjDw_SWsxyJwT9z-YOwWv0ietuQx5fb=WEYdDfvCbzGQ@mail.gmail.com>
<CAB7nPqRgkyR9p-Lz75no+Dz=t6FeHpXA68LU6-sevKhzdvgTjg@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>
Michael Paquier <michael.paquier@gmail.com> writes:
> ... There are even some apps that do not use pgbouncer, but drop
> sessions after a timeout of inactivity to avoid a memory bloat because
> of the problem of this thread.
Yeah, a certain company I used to work for had to do that, though their
problem had more to do with bloat in plpgsql's compiled-functions cache
(and ensuing bloat in the plancache), I believe.
Still, I'm pretty suspicious of anything that will add overhead to
catcache lookups. If you think the performance of those is not absolutely
critical, turning off the caches via -DCLOBBER_CACHE_ALWAYS will soon
disabuse you of the error.
I'm inclined to think that a more profitable direction to look in is
finding a way to limit the cache size. I know we got rid of exactly that
years ago, but the problems with it were (a) the mechanism was itself
pretty expensive --- a global-to-all-caches LRU list IIRC, and (b) there
wasn't a way to tune the limit. Possibly somebody can think of some
cheaper, perhaps less precise way of aging out old entries. As for
(b), this is the sort of problem we made GUCs for.
But, again, the catcache isn't the only source of per-process bloat
and I'm not even sure it's the main one. A more holistic approach
might be called for.
regards, tom lane
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: tgl@sss.pgh.pa.us, michael.paquier@gmail.com, robertmhaas@gmail.com, craig@2ndquadrant.com, horiguchi.kyotaro@lab.ntt.co.jp
Subject: Re: Protect syscache from bloating with negative cache entries
In-Reply-To: <30626.1484348321@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox