pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Use ppoll(2), if available, to wait for input in pgbench.
Date: Mon, 24 Sep 2018 18:41:10 +0000
Message-ID: <E1g4VnC-0000BC-J5@gemulon.postgresql.org> (raw)

Use ppoll(2), if available, to wait for input in pgbench.

Previously, pgbench always used select(2) for this purpose, but that's
problematic for very high client counts, because select() can't deal
with file descriptor numbers larger than FD_SETSIZE.  It's pretty common
for that to be only 1024 or so, whereas modern OSes can allow many more
open files than that.  Using poll(2) would surmount that problem, but it
creates another one: poll()'s timeout resolution is only 1ms, which is
poor enough to cause problems with --rate specifications approaching or
exceeding 1K TPS.

On platforms that have ppoll(2), which includes Linux and recent
FreeBSD, we can use that to avoid the FD_SETSIZE problem without any
loss of timeout resolution.  Hence, add configure logic to test for
ppoll(), and use it if available.

This patch introduces an abstraction layer into pgbench that could
be extended to support other kernel event-wait APIs such as kevents.
But actually adding such support is a matter for some future patch.

Doug Rady, reviewed by Robert Haas and Fabien Coelho, and whacked around
a good bit more by me

Discussion: https://postgr.es/m/23D017C9-81B7-484D-8490-FD94DEC4DF59@amazon.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/60e612b602999e670f2d57a01e52799eaa903ca9

Modified Files
--------------
configure                     |   2 +-
configure.in                  |   2 +-
src/bin/pgbench/pgbench.c     | 289 ++++++++++++++++++++++++++++++++++++------
src/include/pg_config.h.in    |   3 +
src/include/pg_config.h.win32 |   3 +
src/template/linux            |   1 +
6 files changed, 258 insertions(+), 42 deletions(-)



Message-ID: <E1g4VnC-0000BC-J5@gemulon.postgresql.org>
Permalink:  ../E1g4VnC-0000BC-J5@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1g4VnC-0000BC-J5@gemulon.postgresql.org

 · 

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-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Use ppoll(2), if available, to wait for input in pgbench.
  In-Reply-To: <E1g4VnC-0000BC-J5@gemulon.postgresql.org>
  References: <E1g4VnC-0000BC-J5@gemulon.postgresql.org>

* 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