|The PostgreSQL 9.0 Reference Manual - Volume 3 - Server Administration Guide
by The PostgreSQL Global Development Group
Paperback (6"x9"), 274 pages
RRP £9.95 ($14.95)
Sales of this book support the PostgreSQL project! Get a printed copy>>>
3.4.2 Resource Limits
Unix-like operating systems enforce various kinds of resource limits
that might interfere with the operation of your
PostgreSQL server. Of particular
importance are limits on the number of processes per user, the
number of open files per process, and the amount of memory available
to each process. Each of these have a “hard” and a
“soft” limit. The soft limit is what actually counts
but it can be changed by the user up to the hard limit. The hard
limit can only be changed by the root user. The system call
setrlimit is responsible for setting these
parameters. The shell's built-in command
(Bourne shells) or
limit (csh) is
used to control the resource limits from the command line. On
BSD-derived systems the file ‘/etc/login.conf’
controls the various resource limits set during login. See the
operating system documentation for details. The relevant
default:\ ... :datasize-cur=256M:\ :maxproc-cur=256:\ :openfiles-cur=256:\ ...
-cur is the soft limit. Append
-max to set the hard limit.)
Kernels can also have system-wide limits on some resources.
- On Linux ‘/proc/sys/fs/file-max’ determines the maximum number of open files that the kernel will support. It can be changed by writing a different number into the file or by adding an assignment in ‘/etc/sysctl.conf’. The maximum limit of files per process is fixed at the time the kernel is compiled; see ‘/usr/src/linux/Documentation/proc.txt’ for more information.
The PostgreSQL server uses one process per connection so you should provide for at least as many processes as allowed connections, in addition to what you need for the rest of your system. This is usually not a problem but if you run several servers on one machine things might get tight.
The factory default limit on open files is often set to “socially friendly” values that allow many users to coexist on a machine without using an inappropriate fraction of the system resources. If you run many servers on a machine this is perhaps what you want, but on dedicated servers you might want to raise this limit.
On the other side of the coin, some systems allow individual
processes to open large numbers of files; if more than a few
processes do so then the system-wide limit can easily be exceeded.
If you find this happening, and you do not want to alter the
system-wide limit, you can set PostgreSQL's
max_files_per_process configuration parameter to
limit the consumption of open files.
|ISBN 9781906966072||The PostgreSQL 9.0 Reference Manual - Volume 3 - Server Administration Guide||See the print edition|