Max backend limits cleaned up

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-hackers(at)postgreSQL(dot)org
Subject: Max backend limits cleaned up
Date: 1999-02-19 06:58:19
Message-ID: 13829.919407499@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I have just checked in code changes (no doc updates yet :-() that
address our recent discussions about how many backend processes
can be used. Specifically:

configure takes a --with-maxbackends=N switch that sets the hard limit
on the maximum number of backends per postmaster. (It's still a hard
limit because several arrays are sized by MAXBACKENDS. I didn't think
it was worth trying to change that.) The default is still 64.

The postmaster can be started with a "-N backends" switch that sets
a smaller limit on the number of backends for this postmaster.
The only cost of having a large MAXBACKENDS constant is a few dozen
bytes of shared memory per array slot, so if you want you can configure
MAXBACKENDS pretty large and then set the effective limit with -N at
postmaster startup.

When the postmaster is started, it will immediately acquire enough
semaphores to support min(MAXBACKENDS, -N) backend processes.
If your kernel sema parameters are too low to allow that, you get an
immediate failure, rather than failure under peak load. The postmaster
just refuses to start up, with a log message like this:
IpcSemaphoreCreate: semget failed (No space left on device)
key=5440026, num=16, permission=600
(Right at this instant, it looks like it fails to release whatever
semas it did acquire. Ugh. Think I can fix that though.)

I have verified that I can start more than 64 backends after suitable
configuration, but I am not in a position to check that things work
smoothly with a really large number of backends. I found one parameter
(MAX_PROC_SEMS) that was hard-wired at 128 rather than set equal to
MaxBackendIds, so I am a little worried that there might be others.
If anyone has the time and interest to push the envelope with a few
hundred backends, please report back!

regards, tom lane

Browse pgsql-hackers by date

  From Date Subject
Next Message Ron Snyder 1999-02-19 10:50:16 Re: [HACKERS] large objects failing (hpux10.20 sparc/solaris 2.6, gcc 2.8.1)
Previous Message Vince Vielhaber 1999-02-18 20:58:56 RE: [HACKERS] 6.4 Build Error from CVS snapshot