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

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Tomas Vondra <tomas@vondra.me>
Cc: Jelte Fennema-Nio <postgres@jeltef.nl>, PostgreSQL-development <pgsql-hackers@postgresql.org>, Andres Freund <andres@anarazel.de>
Date: 2025-02-11T23:04:15Z
Lists: pgsql-hackers
Tomas Vondra <tomas@vondra.me> writes:
> On 2/11/25 21:18, Tom Lane wrote:
>> I think what we actually would like to know is how often we have to
>> close an open FD in order to make room to open a different file.
>> Maybe that's the same thing you mean by "cache miss", but it doesn't
>> seem like quite the right terminology.  Anyway, +1 for adding some way
>> to discover how often that's happening.

> We can count the evictions (i.e. closing a file so that we can open a
> new one) too, but AFAICS that's about the same as counting "misses"
> (opening a file after not finding it in the cache). After the cache
> warms up, those counts should be about the same, I think.

Umm ... only if the set of files you want access to is quite static,
which doesn't seem like a great bet in the presence of temporary
tables and such.  I think if we don't explicitly count evictions
then we'll be presenting misleading results.

			regards, tom lane



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.