Thread: Why must -N be >= 16?

Why must -N be >= 16?

From
The Hermit Hacker
Date:
Just trying to start up a 'mini-process' of -B 8 -N 4, and it tells me
that -N  must be >= 16 ... why?  

documentation doesn't seem to imply/indicate this, should it?
      -N n_backends           n_backends is the maximum number  of  backend  server           processes  that  this
postmasteris allowed to start.           In the stock configuration, this  value  defaults  to           32,  and  can
be set as high as 1024 if your system           will support that many processes.  Both  the  default           and
upper limit values can be altered when building           Postgres (see src/include/config.h).
 

For security reasons, I have a server running on its own port, and I want
to restrict the amount of shared memory that it uses, and I know the app
will never open more then 4 backends (it would be lucky to hit 2), so
figured 8/4 would be nice and safe...

Thanks...

Marc G. Fournier                   ICQ#7615664               IRC Nick: Scrappy
Systems Administrator @ hub.org 
primary: scrappy@hub.org           secondary: scrappy@{freebsd|postgresql}.org 



Re: [HACKERS] Why must -N be >= 16?

From
Tom Lane
Date:
The Hermit Hacker <scrappy@hub.org> writes:
> Just trying to start up a 'mini-process' of -B 8 -N 4, and it tells me
> that -N  must be >= 16 ... why?  

You misread it --- -N can be as small as you like, but we don't allow
a really tiny -B.  To quote the code:
   if (NBuffers < 2 * MaxBackends || NBuffers < 16)   {       /* Do not accept -B so small that backends are likely to
starvefor        * lack of buffers.  The specific choices here are somewhat arbitrary.        */       fprintf(stderr,
"%s:-B must be at least twice -N and at least 16.\n",               progname);       exit(1);   }
 

I'm not even real sure that -B 16 is going to work well if you throw
complex queries at it --- we've not stressed the system with small
numbers of buffers.
        regards, tom lane