FD_SETSIZE limitation in Windows hamstringing pgbench.c
This change in pgbench.c:
revision 1.71
date: 2007-08-25 10:21:14 +0100; author: ishii; state: Exp; lines: +7 -2;
The upper limit for -c option of pgbench is now obtained from
(FD_SETSIZE - 10) rather than a hardwired number.
Turns out to be, perhaps, ill-advised on Windows where FD_SETSIZE defaults to
64 but can be adjusted by #defining it before including winsock.h. At least
that's what I'm reading on google, I don't know have a Windows machine to test
with myself. But it's definitely true that on Windows you get an error if you
try to run pgbench with more than 54 clients.
I think this can be solved by simply adding this:
--- pgbench.c 27 Sep 2007 21:39:43 +0100 1.72
+++ pgbench.c 22 Oct 2007 10:55:57 +0100
@@ -24,6 +24,7 @@
#include <ctype.h>
#ifdef WIN32
+#define FD_SETSIZE 1024
#include <win32.h>
#else
#include <sys/time.h>
But as I said, I can't test it conveniently. Plus Postgres currently is
bombing out with more than 45 clients anyways due to the handles issue that
others are looking into (hence finding this limitation).
--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com
On Mon, Oct 22, 2007 at 11:11:47AM +0100, Gregory Stark wrote:
This change in pgbench.c:
revision 1.71
date: 2007-08-25 10:21:14 +0100; author: ishii; state: Exp; lines: +7 -2;
The upper limit for -c option of pgbench is now obtained from
(FD_SETSIZE - 10) rather than a hardwired number.Turns out to be, perhaps, ill-advised on Windows where FD_SETSIZE defaults to
64 but can be adjusted by #defining it before including winsock.h. At least
that's what I'm reading on google, I don't know have a Windows machine to test
with myself. But it's definitely true that on Windows you get an error if you
try to run pgbench with more than 54 clients.I think this can be solved by simply adding this:
--- pgbench.c 27 Sep 2007 21:39:43 +0100 1.72 +++ pgbench.c 22 Oct 2007 10:55:57 +0100 @@ -24,6 +24,7 @@ #include <ctype.h>#ifdef WIN32
+#define FD_SETSIZE 1024
#include <win32.h>
#else
#include <sys/time.h>But as I said, I can't test it conveniently. Plus Postgres currently is
bombing out with more than 45 clients anyways due to the handles issue that
others are looking into (hence finding this limitation).
Applied, except I added a #undef first so it doesn't produce a warning. I
can consistently run it with about 125 connections now (more than that and
it breaks on the other handle issue)
//Magnus