About default inBufSize (connection read buffer size) in libpq

From: Трофимов Иван <i(dot)trofimow(at)yandex(dot)ru>
To: "pgsql-interfaces(at)lists(dot)postgresql(dot)org" <pgsql-interfaces(at)lists(dot)postgresql(dot)org>
Subject: About default inBufSize (connection read buffer size) in libpq
Date: 2023-03-05 02:42:06
Message-ID: 298631677983213@mail.yandex.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-interfaces

<div>Hi!</div><div> </div><div>I was running some benchmarks for PG driver built on top of libpq async functionality,</div><div>and noticed that recv syscalls issued by the application are limited by 16Kb, which seems to</div><div>be inBufSize coming from makeEmptyPGconn in interfaces/libpq/fe-connect.c.</div><div> </div><div>Hacking that to higher values allowed my benchmarks to issue drastically less syscalls</div><div>when running some heavy selects, both in local and cloud environments, which made them</div><div>significantly faster.</div><div> </div><div>I believe there is a reason for that value to be 16Kb, but i was wondering if it's safe to change</div><div>this default to user-provided value, and if it is - could this functionality be added into API?</div>

Attachment Content-Type Size
unknown_filename text/html 782 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Smith 2023-03-05 07:52:19 Re: Deduplicate logicalrep_read_tuple()
Previous Message Dave Cramer 2023-03-05 00:39:23 Re: Request for comment on setting binary format output per session

Browse pgsql-interfaces by date

  From Date Subject
Next Message Flaris Feller 2023-03-06 10:36:32 Transaction control in a C language function
Previous Message Marco Bambini 2022-12-10 07:55:57 Re: Libpq linked statically linked to OpenSSL/LibreSSL