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

2022-08-22 Thread Thomas Munro
On Tue, Aug 23, 2022 at 3:53 PM Tom Lane wrote: > Thomas Munro writes: > > On Tue, Aug 23, 2022 at 4:57 AM Tom Lane wrote: > > +service the requests, with those clients receiving unhelpful > > +connection failure errors such as Resource temporarily > > +unavailable. > > > LGTM but I

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

2022-08-22 Thread Tom Lane
Thomas Munro writes: > On Tue, Aug 23, 2022 at 4:57 AM Tom Lane wrote: > +service the requests, with those clients receiving unhelpful > +connection failure errors such as Resource temporarily > +unavailable. > LGTM but I guess I would add "... or Connection refused"? Is that the sp

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

2022-08-22 Thread Junwang Zhao
Ok, thanks for the clarification. On Tue, Aug 23, 2022 at 11:37 AM Tom Lane wrote: > > Junwang Zhao writes: > > Just curious, *backlog* defines the maximum pending connections, > > why do we need to double the MaxConnections as the queue size? > > The postmaster allows up to twice MaxConnections

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

2022-08-22 Thread Tom Lane
Junwang Zhao writes: > Just curious, *backlog* defines the maximum pending connections, > why do we need to double the MaxConnections as the queue size? The postmaster allows up to twice MaxConnections child processes to exist, per the comment in canAcceptConnections: * We allow more connec

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

2022-08-22 Thread Junwang Zhao
Just curious, *backlog* defines the maximum pending connections, why do we need to double the MaxConnections as the queue size? It seems *listen* with larger *backlog* will tell the OS maintain a larger buffer? - maxconn = MaxBackends * 2; - if (maxconn > PG_SOMAXCONN) - maxconn = PG_SOMAXCONN; +

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

2022-08-22 Thread Thomas Munro
On Tue, Aug 23, 2022 at 4:57 AM Tom Lane wrote: > 0001 adds a para about how to raise the listen queue length. +service the requests, with those clients receiving unhelpful +connection failure errors such as Resource temporarily +unavailable. LGTM but I guess I would add "... or Conn

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

2022-08-22 Thread Kevin McKibbin
Thanks for your input everyone! I wanted to confirm that increasing the somaxconn also fixed the issue for me. Kevin > $ cat /proc/sys/net/core/somaxconn > 128 > > by default, which is right about where the problem starts. After > > $ sudo sh -c 'echo 1000 >/proc/sys/net/core/somaxconn' > > *an

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

2022-08-22 Thread Tom Lane
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 purpos