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 1goPPA-0003J7-Od for pgsql-hackers@arkaria.postgresql.org; Tue, 29 Jan 2019 09:10:05 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1goPP9-0000RH-7s for pgsql-hackers@arkaria.postgresql.org; Tue, 29 Jan 2019 09:10:03 +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 1goPP8-0000R5-QR for pgsql-hackers@lists.postgresql.org; Tue, 29 Jan 2019 09:10:03 +0000 Received: from mail.postgrespro.ru ([93.174.131.138]) by makus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1goPP0-0005fr-Fm for pgsql-hackers@postgresql.org; Tue, 29 Jan 2019 09:10:01 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.postgrespro.ru (Postfix) with ESMTP id 73A8F21DC9A9; Tue, 29 Jan 2019 12:09:51 +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 45AFD21DC998; Tue, 29 Jan 2019 12:09:51 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1548752991; bh=oiE8gnuGssy9EisxJeDo2MchmnTiy81c3wZ38Xqnwio=; h=Subject:To:Cc:References:From:Date:In-Reply-To; b=mp0LdfrGKrsrWhWHC4rMAXYteNIcEMQ4Wn3aIhNP18Dv4/q+13feryUbhRL8Uv3R0 4tr11wCyGsULgLCtYoa+TzHDLcfYApi+LA1RIWQ/D4caKNFFBWEOkN9rIA0HsDKSP4 XfpLWBNarbt/kaTqIdj/74onC9DC8q3mgYSo8WSE= Subject: Re: Built-in connection pooler To: Bruce Momjian Cc: PostgreSQL Hackers , Dimitri Fontaine References: <20190128211040.GF26761@momjian.us> From: Konstantin Knizhnik Message-ID: Date: Tue, 29 Jan 2019 12:09:50 +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: <20190128211040.GF26761@momjian.us> Content-Type: text/plain; charset=utf-8; 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 0:10, Bruce Momjian wrote: > On Thu, Jan 24, 2019 at 08:14:41PM +0300, Konstantin Knizhnik wrote: >> The main differences with pgbouncer&K are that: >> >> 1. It is embedded and requires no extra steps for installation and >> configurations. >> 2. It is not single threaded (no bottleneck) >> 3. It supports all clients (if client needs session semantic, then it will be >> implicitly given dedicated backend) >> >> >> Some performance results (pgbench -S -n): >> >> ┌────────────────┬────────┬─────────────┬─────────┬─────────────────────────┐ >> │ #Connections │ Proxy │ Proxy/SSL │ Direct │ Direct/SSL │ >> ├────────────────┼────────┼─────────────┼─────────┼──────────────┤ >> │ 1 │ 13752 │ 12396 │ 17443 │ 15762 │ >> ├────────────────┼────────┼─────────────┼─────────┼──────────────┤ >> │ 10 │ 53415 │ 59615 │ 68334 │ 85885 │ >> ├────────────────┼────────┼─────────────┼─────────┼──────────────┤ >> │ 1000 │ 60152 │ 20445 │ 60003 │ 24047 │ >> └────────────────┴────────┴─────────────┴─────────┴──────────────┘ > It is nice it is a smaller patch. Please remind me of the performance > advantages of this patch. > The primary purpose of pooler is efficient support of large number of connections and minimizing system resource usage. But as far as Postgres is not scaling well at SMP system with larger number of CPU cores (due to many reasons discussed in hackers) reducing number of concurrently working backends can also significantly increase performance. I have not done such testing yet but I am planing to do it as well as comparison with pgbouncer and Odyssey. But please notice that this proxy approach is by design slower than my previous implementation used in PgPRO-EE (based on socket redirection). At some workloads connections throughout proxy cause up to two times decrease of performance comparing with dedicated backends. There is no such problem with old connection pooler implementation which was always not worser than vanilla. But it doesn't support SSL connections and requires much more changes in Postgres core. -- Konstantin Knizhnik Postgres Professional: http://www.postgrespro.com The Russian Postgres Company