pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Andres Freund <andres@anarazel.de>
Cc: Artemiy Ryabinkov <getlag@ya.ru>
Cc: pgsql-general@postgresql.org
Subject: Re: Why does backend send buffer size hardcoded at 8KB?
Date: Sat, 27 Jul 2019 19:10:22 -0400
Message-ID: <9502.1564269022@sss.pgh.pa.us> (raw)
In-Reply-To: <20190727225854.w2f2e5n6lepqbbui@alap3.anarazel.de>
References: <0cdc5485-cb3c-5e16-4a46-e3b2f7a41322@ya.ru>
	<20190727205243.l5xyhsg2y7aasgdd@alap3.anarazel.de>
	<762.1564266890@sss.pgh.pa.us>
	<20190727225854.w2f2e5n6lepqbbui@alap3.anarazel.de>

Andres Freund <andres@anarazel.de> writes:
> On 2019-07-27 18:34:50 -0400, Tom Lane wrote:
>> Yeah.  The existing commentary about that is basically justifying 8K
>> as being large enough to avoid performance issues; if somebody can
>> show that that's not true, I wouldn't have any hesitation about
>> kicking it up.

> You think that unnecessary fragmentation, which I did show, isn't good
> enough? That does have cost on the network level, even if it possibly
> doesn't show up that much in timing.

I think it is worth doing some testing, rather than just blindly changing
buffer size, because we don't know how much we'd have to change it to
have any useful effect.

> Additionally we perhaps ought to just not use the send buffer when
> internal_putbytes() is called with more data than can fit in the
> buffer. We should fill it with as much data as fits in it (so the
> pending data like the message header, or smaller previous messages, are
> flushed out in the largest size), and then just call secure_write()
> directly on the rest. It's not free to memcpy all that data around, when
> we already have a buffer.

Maybe, but how often does a single putbytes call transfer more than 16K?
(If you fill the existing buffer, but don't have a full bufferload
left to transfer, I doubt you want to shove the fractional bufferload
directly to the kernel.)  Perhaps this added complexity will pay for
itself, but I don't think we should just assume that.

> While the receive side is statically allocated, I don't think it ends up
> in the process image as-is - as the contents aren't initialized, it ends
> up in .bss.

Right, but then we pay for COW when a child process first touches it,
no?  Maybe the kernel is smart about pages that started as BSS, but
I wouldn't bet on it.

			regards, tom lane





view thread (9+ messages)  latest in thread

Message-ID: <9502.1564269022@sss.pgh.pa.us>
Permalink:  ../9502.1564269022@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/9502.1564269022@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: tgl@sss.pgh.pa.us, andres@anarazel.de, getlag@ya.ru
  Subject: Re: Why does backend send buffer size hardcoded at 8KB?
  In-Reply-To: <9502.1564269022@sss.pgh.pa.us>
  References: <0cdc5485-cb3c-5e16-4a46-e3b2f7a41322@ya.ru> <20190727205243.l5xyhsg2y7aasgdd@alap3.anarazel.de> <762.1564266890@sss.pgh.pa.us> <20190727225854.w2f2e5n6lepqbbui@alap3.anarazel.de> <9502.1564269022@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox