max client limit in pgbench

Started by Tatsuo Ishiiover 18 years ago2 messages
#1Tatsuo Ishii
ishii@postgresql.org

I found following in pgbench.c:

#define MAXCLIENTS 1024 /* max number of clients allowed */

This is used for calculating the upper limit of -c option. However
actual limit is coming from the number of descriptors that select(2)
can watch (besides the number of file descriptors allowed by the
kernal. This is different story though, I think). So it seems the line
would be better looking at FD_SETSIZE in select.h.

Included is the proposed patch. Comments?
--
Tatsuo Ishii
SRA OSS, Inc. Japan

*** pgbench.c	22 Aug 2007 23:03:27 -0000	1.70
--- pgbench.c	25 Aug 2007 02:49:34 -0000
***************
*** 53,59 ****
  /********************************************************************
   * some configurable parameters */

! #define MAXCLIENTS 1024 /* max number of clients allowed */

  int			nclients = 1;		/* default number of simulated clients */
  int			nxacts = 10;		/* default number of transactions per clients */
--- 53,64 ----
  /********************************************************************
   * some configurable parameters */

! /* max number of clients allowed */
! #ifdef FD_SETSIZE
! #define MAXCLIENTS FD_SETSIZE
! #else
! #define MAXCLIENTS 1024
! #endif

int nclients = 1; /* default number of simulated clients */
int nxacts = 10; /* default number of transactions per clients */

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Tatsuo Ishii (#1)
Re: max client limit in pgbench

Tatsuo Ishii <ishii@postgresql.org> writes:

This is used for calculating the upper limit of -c option. However
actual limit is coming from the number of descriptors that select(2)
can watch (besides the number of file descriptors allowed by the
kernal. This is different story though, I think). So it seems the line
would be better looking at FD_SETSIZE in select.h.

This seems reasonable, but surely it needs to be FD_SETSIZE less a bit,
because stdin/stdout/etc eat FD numbers too. Maybe
#define MAXCLIENTS (FD_SETSIZE - 10)

regards, tom lane