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

Andres Freund <andres@anarazel.de>

From: Andres Freund <andres@anarazel.de>
To: Jelte Fennema-Nio <postgres@jeltef.nl>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, Tomas Vondra <tomas@vondra.me>, PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2025-02-20T00:37:55Z
Lists: pgsql-hackers
Hi,

On 2025-02-17 21:25:33 +0100, Jelte Fennema-Nio wrote:
> On Mon, 17 Feb 2025 at 18:24, Andres Freund <andres@anarazel.de> wrote:
> > Why not do this only in the if (rlim.rlim_cur < nclients + 3) case?
> 
> Done, I also changed it to not bump to rlim_max, but only to nclients
> + 3. The rest of the patches I'll update later. But response below.

I've pushed this, with one trivial modification: I added %m to the error
message in case setrlimit() fails. That's really unlikely to ever happen, but
...

Greetings,

Andres Freund



Commits

  1. Redefine max_files_per_process to control additionally opened files

  2. pgbench: Increase RLIMIT_NOFILE if necessary

  3. Move extra code out of the Pre/PostRestoreCommand() section.