Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lidBq-0001zE-G4 for pgsql-bugs@arkaria.postgresql.org; Mon, 17 May 2021 13:21:46 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lidBp-0005Pn-G3 for pgsql-bugs@arkaria.postgresql.org; Mon, 17 May 2021 13:21:45 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lidBp-0005Pf-7U for pgsql-bugs@lists.postgresql.org; Mon, 17 May 2021 13:21:45 +0000 Received: from mail.postgrespro.ru ([93.174.131.139]) by makus.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lidBj-00022Y-7W for pgsql-bugs@lists.postgresql.org; Mon, 17 May 2021 13:21:44 +0000 Received: from mail.postgrespro.ru (cyclops.postgrespro.ru [93.174.131.138]) (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 C10CF21C7ECB; Mon, 17 May 2021 16:21:36 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1621257696; bh=b6ajJnSzhQOwusYWacYfz/CN1iA2DugzmpxIEi09SMo=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=DfO4/8WQPsAUJmk0MhQ0fDbRRTtwv9VUbihEXvXXvoW+rZD7f18uzE+/OCFkclChv v04kYJoK+P1R8Kk32EsQWLFUJpM5m7ESdUgCEBj5rRvyFAaNMQk0Y4m4JoKatsFfPw 4JaAxNWnrRMwtsXiZbQaN0HS8h0aQJC17LabR/KM= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Date: Mon, 17 May 2021 16:21:36 +0300 From: Yura Sokolov To: Andres Freund Cc: rony.kurniawan@oracle.com, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #17005: Enhancement request: Improve walsender throughput by aggregating multiple messages in one send In-Reply-To: <20210516224413.xitbilinlyrlt42m@alap3.anarazel.de> References: <17005-3e1030784d5440c4@postgresql.org> <20210516224413.xitbilinlyrlt42m@alap3.anarazel.de> User-Agent: Roundcube Webmail/1.4.0 Message-ID: X-Sender: y.sokolov@postgrespro.ru List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Andres Freund писал 2021-05-17 01:44: > Hi, > > On 2021-05-13 00:31:53 +0000, PG Bug reporting form wrote: >> I measured the throughput of reading the logical replication slot and >> found >> that in smaller row size (512 bytes) the throughput is 50% lower >> compared to >> 1024 bytes. > > Huh, that is interesting. > > >> tcpdump shows that ethernet packets sent by the replication server >> contain >> only one message per packet (see tcpdump output below). >> May be this is the intended design to achieve low latency but this is >> not >> favorable in application that requires high throughput. > > What kind of network is this? I would have expected that if the network > can't keep up the small sends would end up getting aggregated into > larger packets anyway? Are you hitting a PPS limit due to the small > packages, but not yet the throughput limit? I believe the reason is more in sys-call and kernel cpu time overhead than in network throughput. Especially in this "after meltdown+spectre" time. > >> Is it possible for PostgreSQL to enable Nagle's algorithm on the >> streaming >> socket for replication? >> Or aggegate the messages manually before sending them in one send()? > > I think we can probably do better in cases a transaction is more than a > single change - but I don't think either enabling nagle's or > aggregation > are really an option in case of single row transactions. The latency > impact for some scenarios seems too high. We have commit_siblings and commit_delay options. Probably similar could be introduced for replication slot? regards Yura