From: Tomas Vondra <tomas.vondra@2ndquadrant.com>
To: Andres Freund <andres@anarazel.de>
Cc: Peter Geoghegan <pg@heroku.com>
Cc: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: pgsql-bugs@postgresql.org, Andrew Gierth <andrew@tao11.riddles.org.uk>
Cc: blake@rcmail.com
Subject: Re: BUG #14231: logical replication wal sender process spins when using error traps in function
Date: Tue, 19 Jul 2016 15:35:24 +0200
Message-ID: <d4a5bf3c-f03b-92be-9f34-a772406f1817@2ndquadrant.com> (raw)
In-Reply-To: <20160719052751.5arxjvgkr34q6iff@alap3.anarazel.de>
References: <878txea5b4.fsf@news-spur.riddles.org.uk>
<20160706212600.GA649263@alvherre.pgsql>
<CAM3SWZSqBWmJEwu6-aFkN7XkPdybw_nrSfcjNtnJvq8m8-Rcig@mail.gmail.com>
<b9465329-acc1-8cc0-65e2-d3199a745e4b@2ndquadrant.com>
<8ec28b02-6ae5-369c-ec33-a7f59172c935@2ndquadrant.com>
<20160719052751.5arxjvgkr34q6iff@alap3.anarazel.de>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
On 07/19/2016 07:27 AM, Andres Freund wrote:
> Hi,
>
> On 2016-07-19 07:04:43 +0200, Tomas Vondra wrote:
>> So, I've spent a few hours experimenting with this idea, and I
>> believe it seems like a good way forward. Attached is an early WIP
>> patch that does this:
>
> Cool! Thanks for looking into this.
>
>
>> I'm not sure whether the SlabContext is needed here - perhaps
>> AllocSets would do equally well, at least in this case. I however
>> wonder whether the existing local slab cache can actually improve
>> anything, because what I see is a long sequence of pallocs()
>> followed by a long sequence of pfrees(), which makes any reuse
>> impossible. But I guess there are other cases where the palloc()
>> and pfree() calls are mixed.
>
> In something more oltp like you'll see exactly that. IIRC, in
> pgbench, we pretty much never allocate for the slab allocated stuff,
> after some warmup.
Yeah. Haven't done much testing at night. I think we'll need a set of
test cases to validate the changes. We certainly don't want to improve
one case and regress two others.
>
>> The other thing is that splitting the tuple context into two parts
>> seems a bit wasteful - this mostly follows the MaxHeapTupleSize
>> idea from the existing slab code, but how many tuples actually are
>> this big?
>
> The issue is that allocating them differently sized leads to massive
> memory fragmentation over time.
>
Sure, in all allocators we basically trade space and time efficiency. If
we could get some apriori some estimate of the tuple size, we could
probably tune this. It's just that ~8kB per tuple seems a bit too high.
regards
--
Tomas Vondra http://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: tomas.vondra@2ndquadrant.com, andres@anarazel.de, pg@heroku.com, alvherre@2ndquadrant.com, andrew@tao11.riddles.org.uk, blake@rcmail.com
Subject: Re: BUG #14231: logical replication wal sender process spins when using error traps in function
In-Reply-To: <d4a5bf3c-f03b-92be-9f34-a772406f1817@2ndquadrant.com>
References: <878txea5b4.fsf@news-spur.riddles.org.uk> <20160706212600.GA649263@alvherre.pgsql> <CAM3SWZSqBWmJEwu6-aFkN7XkPdybw_nrSfcjNtnJvq8m8-Rcig@mail.gmail.com> <b9465329-acc1-8cc0-65e2-d3199a745e4b@2ndquadrant.com> <8ec28b02-6ae5-369c-ec33-a7f59172c935@2ndquadrant.com> <20160719052751.5arxjvgkr34q6iff@alap3.anarazel.de> <d4a5bf3c-f03b-92be-9f34-a772406f1817@2ndquadrant.com>
* 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