Another kernel limit that may be of concern when supporting large
numbers of client connections is the maximum socket connection queue
length. If more than that many connection requests arrive within a very
- short period, some may get rejected before the postmaster can service
+ short period, some may get rejected before the
PostgreSQL server can service
the requests, with those clients receiving unhelpful connection failure
errors such as Resource temporarily unavailable
or
Connection refused
. The default queue length limit is 128
on many platforms. To raise it, adjust the appropriate kernel parameter
- via
sysctl, then restart the
postmaster.
+ via
sysctl, then restart the
PostgreSQL server.
The parameter is variously named net.core.somaxconn
on Linux, kern.ipc.soacceptqueue on newer FreeBSD,
and kern.ipc.somaxconn on macOS and other BSD
echo -1000 > /proc/self/oom_score_adj
- in the postmaster's startup script just before invoking the postmaster.
+ in the
PostgreSQL startup script just before
+ invoking postgres.
Note that this action must be done as root, or it will have no effect;
so a root-owned startup script is the easiest place to do it. If you
do this, you should also set these environment variables in the startup
- script before invoking the postmaster:
+ script before invoking postgres:
export PG_OOM_ADJUST_FILE=/proc/self/oom_score_adj
export PG_OOM_ADJUST_VALUE=0