Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1goPaP-0003ye-Fi for pgsql-hackers@arkaria.postgresql.org; Tue, 29 Jan 2019 09:21:42 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1goPaN-0007kl-Rf for pgsql-hackers@arkaria.postgresql.org; Tue, 29 Jan 2019 09:21:39 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1goPaN-0007ke-FI for pgsql-hackers@lists.postgresql.org; Tue, 29 Jan 2019 09:21:39 +0000 Received: from mail.postgrespro.ru ([93.174.131.138]) by makus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1goPaJ-0005zR-NH for pgsql-hackers@postgresql.org; Tue, 29 Jan 2019 09:21:38 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.postgrespro.ru (Postfix) with ESMTP id 14CAD21DC9EC; Tue, 29 Jan 2019 12:21:34 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at postgrespro.ru X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=x tagged_above=-99 required=4 WHITELISTED tests=[] autolearn=unavailable Received: from [192.168.27.200] (gw.postgrespro.ru [93.174.131.141]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mail.postgrespro.ru (Postfix) with ESMTPSA id B2CB121DC9E6; Tue, 29 Jan 2019 12:21:33 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1548753693; bh=/P8MjyeYjjmHvcvRWjTJAg5XY9vPLCPffSuks2p4L+U=; h=Subject:To:Cc:References:From:Date:In-Reply-To; b=okyyLBNrblM95XRlLzVWhwZ5WmO1ZEW1qClnKB4aAYEcSvKOB0BOgZfXzsStL1nYM eFGXJP2SVQlDbzhppEMqRhKnzpusg7jAWU7vEARtUoVKat33KQZmmne/5y0Z3ocT+P 1Dr0aDuwxS6evinSBc+slK5gg6QNDjwzkmPgMY4Y= Subject: Re: Built-in connection pooler To: Michael Paquier , Dimitri Fontaine Cc: Bruce Momjian , PostgreSQL Hackers References: <20190128211040.GF26761@momjian.us> <20190129051403.GF3121@paquier.xyz> From: Konstantin Knizhnik Message-ID: <8ebc2478-260f-d937-e607-eef4429790de@postgrespro.ru> Date: Tue, 29 Jan 2019 12:21:33 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <20190129051403.GF3121@paquier.xyz> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 29.01.2019 8:14, Michael Paquier wrote: > On Mon, Jan 28, 2019 at 10:33:06PM +0100, Dimitri Fontaine wrote: >> In other cases, it's important to measure and accept the possible >> performance cost of running a proxy server between the client connection >> and the PostgreSQL backend process. I believe the numbers shown in the >> previous email by Konstantin are about showing the kind of impact you >> can see when using the patch in a use-case where it's not meant to be >> helping much, if at all. > Have you looked at the possibility of having the proxy worker be > spawned as a background worker? Yes, it was my first attempt. The main reason why I have implemented it in old ways are: 1. I need to know PID of spawned worker. Strange - it is possible to get PID of dynamic bgworker, but no of static one. Certainly it is possible  to find a way of passing this PID to postmaster but it complicates start of worker. 2. I need to pass socket to spawner proxy.  Once again: it can be implemented also with bgworker but requires more coding (especially taken in account support of Win32 and FORKEXEC mode). > I think that we should avoid spawning > any new processes on the backend from the ground as we have a lot more > infrastructures since 9.3. The patch should actually be bigger, the > code is very raw and lacks comments in a lot of areas where the logic > is not so obvious, except perhaps to the patch author. The main reason for publishing this patch was to receive feedbacks and find places which should be rewritten. I will add more comments but I will be pleased if you point me which places are obscure now and require better explanation. -- Konstantin Knizhnik Postgres Professional: http://www.postgrespro.com The Russian Postgres Company