Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1thxeW-009Bdn-97 for pgsql-hackers@arkaria.postgresql.org; Tue, 11 Feb 2025 21:18:44 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1thxeU-000cRQ-69 for pgsql-hackers@arkaria.postgresql.org; Tue, 11 Feb 2025 21:18:42 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1thxeT-000cRG-T8 for pgsql-hackers@lists.postgresql.org; Tue, 11 Feb 2025 21:18:42 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1thxeS-000I1V-3A for pgsql-hackers@postgresql.org; Tue, 11 Feb 2025 21:18:41 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 51BLIb9D3216370; Tue, 11 Feb 2025 16:18:37 -0500 From: Tom Lane To: Andres Freund cc: Tomas Vondra , Jelte Fennema-Nio , PostgreSQL-development Subject: Re: Bump soft open file limit (RLIMIT_NOFILE) to hard limit on startup In-reply-to: <7u7dbn6s2i6bf3hjzkbqaexj2bpoblqxwbkffbetl4rjv6dcom@s2uickjc5z53> References: <3203865.1739301613@sss.pgh.pa.us> <94798ef1-0f13-416a-983a-88447e434a7f@vondra.me> <7u7dbn6s2i6bf3hjzkbqaexj2bpoblqxwbkffbetl4rjv6dcom@s2uickjc5z53> Comments: In-reply-to Andres Freund message dated "Tue, 11 Feb 2025 16:14:21 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3216368.1739308717.1@sss.pgh.pa.us> Date: Tue, 11 Feb 2025 16:18:37 -0500 Message-ID: <3216369.1739308717@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Andres Freund 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. > And when using something like io_uring for AIO, it'd allow to > max_files_per_process in addition to the files requires for the io_uring > instances. Not following? Surely we'd not be configuring that so early in postmaster start? regards, tom lane