Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bPVC2-0003xP-4p for pgsql-bugs@arkaria.postgresql.org; Tue, 19 Jul 2016 13:36:14 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bPVC0-0001xp-Uw for pgsql-bugs@arkaria.postgresql.org; Tue, 19 Jul 2016 13:36:12 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bPVBN-0001Fs-8r for pgsql-bugs@postgresql.org; Tue, 19 Jul 2016 13:35:33 +0000 Received: from mail-lf0-x231.google.com ([2a00:1450:4010:c07::231]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1bPVBH-0005po-HU for pgsql-bugs@postgresql.org; Tue, 19 Jul 2016 13:35:32 +0000 Received: by mail-lf0-x231.google.com with SMTP id g62so14465848lfe.3 for ; Tue, 19 Jul 2016 06:35:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=LhybLMk/+G2WKior6Ete8wadwNKiQdUlzp6wVeckB08=; b=MW3ZhRTqBNXUZknljB0/QUo8eZj+OMr05uAGS1m3bLEdJXmEA4M2ckieva0p3VNmPd ZCQrA0QxPQPI/BEp8D3BONSDHsyati2ei7Tr01pJsVzkY9yae1T3OWV5DPs0dB4eGlcg FqG9XFY6T696IruoLoPvsAViMOxBQh55fWmFEXUliv0jd7pPumUtAtEWzYnJLJfdM/X7 HGReQAA5D1DhQs21WeOtdhja3nZJgF3TxR+4MizdM04J8ysLoATsdIHC+NFL6HhXXke3 yYWsX1liXC2QhWXvoWhgD3GxezPnBGBV4ANmf3bH6QqLEOosNPH215vHKVPxbQdGwgqJ JHXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=LhybLMk/+G2WKior6Ete8wadwNKiQdUlzp6wVeckB08=; b=iZmucsrMfLhSfdeW1vLpZR6uIgno5OJ7uF1e5Jio2+S8g8yN0X7lfqYBGhLGsq1wx3 49bKKVU/pidyOM7F6207D8qhBf41QRH6cmt+nbtudbrYJjPUanaF5mpX9nHnJ7ZL4G2F zVLHw0JWaD1FjQd4jZzAWxcop/grCsZGGxYAS5JTdzSRf7vRp7Mza4d+5Ufb2whazERV co/mIWn2XsJ85+cHHHFQucS/EayYpyyDBihLLv4oB90PVOR8cjUqEYYNsCIMM9dpzx+K ZdbiSt3AuW7wDxWtKTwOIO3QiZr3NEoYJFKTHe2KAW7+uaBBqkMDufRDPcQ3o0sdzvg6 QRAg== X-Gm-Message-State: ALyK8tIwToG/HF2OXhPRn5TeBvdJ8V3DfvEEPqH7+K5RuW98psqSzL967LRUPv0q3pCKfgXr X-Received: by 10.25.28.16 with SMTP id c16mr4314629lfc.79.1468935326787; Tue, 19 Jul 2016 06:35:26 -0700 (PDT) Received: from [10.137.2.17] (ip-89-177-44-58.net.upcbroadband.cz. [89.177.44.58]) by smtp.gmail.com with ESMTPSA id c125sm3949440lfe.10.2016.07.19.06.35.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 19 Jul 2016 06:35:26 -0700 (PDT) Subject: Re: BUG #14231: logical replication wal sender process spins when using error traps in function To: Andres Freund References: <878txea5b4.fsf@news-spur.riddles.org.uk> <20160706212600.GA649263@alvherre.pgsql> <8ec28b02-6ae5-369c-ec33-a7f59172c935@2ndquadrant.com> <20160719052751.5arxjvgkr34q6iff@alap3.anarazel.de> Cc: Peter Geoghegan , Alvaro Herrera , pgsql-bugs@postgresql.org, Andrew Gierth , blake@rcmail.com From: Tomas Vondra Message-ID: Date: Tue, 19 Jul 2016 15:35:24 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:46.0) Gecko/20100101 Thunderbird/46.0a2 MIME-Version: 1.0 In-Reply-To: <20160719052751.5arxjvgkr34q6iff@alap3.anarazel.de> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org 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