Re: Re: Too many open files (was Re: spinlock problems reported earlier) - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Re: Too many open files (was Re: spinlock problems reported earlier)
Date
Msg-id 16725.967487405@sss.pgh.pa.us
Whole thread Raw
In response to Re: Re: Too many open files (was Re: spinlock problems reported earlier)  (The Hermit Hacker <scrappy@hub.org>)
Responses Re: Re: Too many open files (was Re: spinlock problems reported earlier)  (The Hermit Hacker <scrappy@hub.org>)
Re: Re: Too many open files (was Re: spinlock problems reported earlier)  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
The Hermit Hacker <scrappy@hub.org> writes:
>> cat t.c
> #include <stdio.h>
> #include <unistd.h>

> main()
> {
>   printf("%ld\n", sysconf(_SC_OPEN_MAX));
> }

>> ./t
> 4136

Yup, there's our problem.  Each backend will feel entitled to open up to
about 4100 files, assuming it manages to hit that many distinct tables/
indexes during its run.  You probably haven't got that many, but even
several hundred files times a couple dozen backends would start pushing
your (previous) kernel FD limit.

So, at least on FreeBSD, we can't trust sysconf(_SC_OPEN_MAX) to tell us
the number we need.

An explicit parameter to the postmaster, setting the installation-wide
open file count (with default maybe about 50 * MaxBackends) is starting
to look like a good answer to me.  Comments?
        regards, tom lane


pgsql-hackers by date:

Previous
From: The Hermit Hacker
Date:
Subject: Re: Re: Too many open files (was Re: spinlock problems reported earlier)
Next
From: The Hermit Hacker
Date:
Subject: Re: Re: Too many open files (was Re: spinlock problems reported earlier)