Re: BUG #14231: logical replication wal sender process spins when using error traps in function - Mailing list pgsql-bugs

From Andres Freund
Subject Re: BUG #14231: logical replication wal sender process spins when using error traps in function
Date
Msg-id 20160719052751.5arxjvgkr34q6iff@alap3.anarazel.de
Whole thread Raw
In response to Re: BUG #14231: logical replication wal sender process spins when using error traps in function  (Tomas Vondra <tomas.vondra@2ndquadrant.com>)
Responses Re: BUG #14231: logical replication wal sender process spins when using error traps in function
List pgsql-bugs
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.


> 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.


Greetings,

Andres Freund

pgsql-bugs by date:

Previous
From: Tomas Vondra
Date:
Subject: Re: BUG #14231: logical replication wal sender process spins when using error traps in function
Next
From: Tomas Vondra
Date:
Subject: Re: BUG #14231: logical replication wal sender process spins when using error traps in function