Re: pgbench: could not connect to server: Resource temporarily unavailable

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, Kevin McKibbin <kevinmckibbin123(at)gmail(dot)com>, pgsql-performance(at)lists(dot)postgresql(dot)org
Subject: Re: pgbench: could not connect to server: Resource temporarily unavailable
Date: 2022-08-22 16:57:43
Message-ID: 361175.1661187463@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-performance

OK, here's some proposed patches.

0001 adds a para about how to raise the listen queue length.

0002 isn't quite related, but while writing 0001 I noticed a nearby
use of /proc/sys/... which I thought should be converted to sysctl.
IMO /proc/sys pretty much sucks, at least for documentation purposes,
for multiple reasons:

* It's unlike the way you do things on other platforms.

* "man sysctl" will lead you to useful documentation about how to
use that command. There's no obvious way to find documentation
about /proc/sys.

* It's not at all sudo-friendly. Compare
sudo sh -c 'echo 0 >/proc/sys/kernel/randomize_va_space'
sudo sysctl -w kernel.randomize_va_space=0
The former is a lot longer and it's far from obvious why you have
to do it that way.

* You have to think in sysctl terms anyway if you want to make the
setting persist across reboots, which you almost always do.

* Everywhere else in runtime.sgml, we use sysctl not /proc/sys.

0003 removes PG_SOMAXCONN. While doing that I noticed that this
computation hadn't been touched throughout all the various
changes fooling with exactly what gets counted in MaxBackends.
I think the most appropriate definition for the listen queue
length is now MaxConnections * 2, not MaxBackends * 2, because
the other processes counted in MaxBackends don't correspond to
incoming connections.

I propose 0003 for HEAD only, but the docs changes could be
back-patched.

regards, tom lane

Attachment Content-Type Size
0001-document-somaxconn.patch text/x-diff 1.2 KB
0002-avoid-proc-sys-in-docs.patch text/x-diff 1.7 KB
0003-remove-PG_SOMAXCONN.patch text/x-diff 1.6 KB

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Kevin McKibbin 2022-08-22 21:14:23 Re: pgbench: could not connect to server: Resource temporarily unavailable
Previous Message Tom Lane 2022-08-22 02:55:13 Re: pgbench: could not connect to server: Resource temporarily unavailable