Re: Bump soft open file limit (RLIMIT_NOFILE) to hard limit on startup

From: Jelte Fennema-Nio <postgres(at)jeltef(dot)nl>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Andres Freund <andres(at)anarazel(dot)de>, Tomas Vondra <tomas(at)vondra(dot)me>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Bump soft open file limit (RLIMIT_NOFILE) to hard limit on startup
Date: 2025-02-12 21:52:52
Message-ID: CAGECzQQqO0DKhyZtUWRKSL=WeBSYM=+gZ+dY58xQ2ZnypSONTw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, 11 Feb 2025 at 22:18, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> Andres Freund <andres(at)anarazel(dot)de> writes:
> > My suggestion would be to redefine max_files_per_process as the number of
> > files we try to be able to open in backends. I.e. set_max_safe_fds() would
> > first count the number of already open fds (since those will largely be
> > inherited by child processes) and then check if we can open up to
> > max_files_per_process files in addition. Adjusting the RLIMIT_NOFILE if
> > necessary.
>
> Seems plausible. IIRC we also want 10 or so FDs available as "slop"
> for code that doesn't go through fd.c.

Attached is a patchset that does this. I split off the pgbench change,
which is in the first patch. The change to postmaster is in the
second. And the 3rd patch is a small follow up to make it easier to
notice that max_safe_fds is lower than intended.

Attachment Content-Type Size
v2-0001-Bump-pgbench-soft-open-file-limit-RLIMIT_NOFILE-t.patch text/x-patch 1.8 KB
v2-0002-Bump-postmaster-soft-open-file-limit-RLIMIT_NOFIL.patch text/x-patch 12.2 KB
v2-0003-Reflect-the-value-of-max_safe_fds-in-max_files_pe.patch text/x-patch 1.1 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Nathan Bossart 2025-02-12 22:01:58 Re: Improve CRC32C performance on SSE4.2
Previous Message Devulapalli, Raghuveer 2025-02-12 21:48:57 RE: Improve CRC32C performance on SSE4.2