Re: How many file descriptors does postgres need?

Lists: pgsql-general
From: Royce Ausburn <royce(at)inomial(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: How many file descriptors does postgres need?
Date: 2010-03-09 13:11:57
Message-ID: EB994579-2753-49E8-AB5D-E614B1BF1C79@inomial.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

G'day all,

We recently had a bit of a catastrophe when one of our postgres databases opened too many files. It was a reasonably easy fix, but it did get me thinking. Is there a rule of thumb in determining how many file descriptors should be available to a postgres database/cluster?

I'd be happy to set it to some large number, but I'd really like some confidence about how much the database can grow with a new limit.

Cheers!

--Royce


From: Steve Atkins <steve(at)blighty(dot)com>
To: pgsql-general General <pgsql-general(at)postgresql(dot)org>
Subject: Re: How many file descriptors does postgres need?
Date: 2010-03-09 15:47:56
Message-ID: C630BE64-6331-4CE8-858C-92FCFDE4562F@blighty.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general


On Mar 9, 2010, at 5:11 AM, Royce Ausburn wrote:

> G'day all,
>
> We recently had a bit of a catastrophe when one of our postgres databases opened too many files. It was a reasonably easy fix, but it did get me thinking. Is there a rule of thumb in determining how many file descriptors should be available to a postgres database/cluster?
>
> I'd be happy to set it to some large number, but I'd really like some confidence about how much the database can grow with a new limit.

Postgresql is supposed to cope with file descriptor limits quite happily, as long as the OS actually restricts the number of files a process can have open. If it doesn't restrict the number, just falls over if there's too many, there's a postgresql configuration option to limit it (max_files_per_process, I think).

What OS are you on, and what was the catastrophe?

Cheers,
Steve


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Steve Atkins <steve(at)blighty(dot)com>
Cc: pgsql-general General <pgsql-general(at)postgresql(dot)org>
Subject: Re: How many file descriptors does postgres need?
Date: 2010-03-09 16:06:43
Message-ID: 11530.1268150803@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Steve Atkins <steve(at)blighty(dot)com> writes:
> Postgresql is supposed to cope with file descriptor limits quite happily, as long as the OS actually restricts the number of files a process can have open. If it doesn't restrict the number, just falls over if there's too many, there's a postgresql configuration option to limit it (max_files_per_process, I think).

Usually the problem is not that Postgres falls over, but that everything
else on the box starts to fall over once PG has run the kernel out of
file descriptors. Make sure max_connections * max_files_per_process is
less than the kernel's file table size, with enough daylight for the
machine's other activities.

regards, tom lane