summaryrefslogtreecommitdiff
path: root/src/template
diff options
context:
space:
mode:
authorTom Lane2018-09-24 18:40:58 +0000
committerTom Lane2018-09-24 18:40:58 +0000
commit60e612b602999e670f2d57a01e52799eaa903ca9 (patch)
tree02adae19c3497feb371bab1c4cc9c108eb0f8f8f /src/template
parent87d9bbca13f9c6b8f6ee986f0e399cb83bd731d4 (diff)
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
Diffstat (limited to 'src/template')
-rw-r--r--src/template/linux1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/template/linux b/src/template/linux
index f820bf7280f..e39290845ad 100644
--- a/src/template/linux
+++ b/src/template/linux
@@ -6,6 +6,7 @@ if test x"$PREFERRED_SEMAPHORES" = x"" ; then
fi
# Force _GNU_SOURCE on; plperl is broken with Perl 5.8.0 otherwise
+# This is also required for ppoll(2), and perhaps other things
CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
# If --enable-profiling is specified, we need -DLINUX_PROFILE