Re: Changing the default configuration

From: "Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au>
To: "Robert Treat" <xzilla(at)users(dot)sourceforge(dot)net>, "Tatsuo Ishii" <t-ishii(at)sra(dot)co(dot)jp>
Cc: <scott(dot)marlowe(at)ihs(dot)com>, <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Changing the default configuration
Date: 2003-02-13 01:43:23
Message-ID: GNELIHDDFBOCMGBFGEFOAEIGCFAA.chriskl@familyhealth.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-advocacy pgsql-hackers pgsql-performance

> Had this happen at a previous employer, and it definitely is bad. I
> believe we had to do a reboot to clear it up. And we saw the problem a
> couple of times since the sys admin wasn't able to deduce what had
> happened the first time we got it. IIRC the problem hit somewhere around
> 150 connections, so we ran with 128 max. I think this is a safe number
> on most servers these days (running linux as least) though out of the
> box I might be more inclined to limit it to 64. If you do hit a file
> descriptor problem, *you are hosed*.

Just yesterday I managed to hose my new Postgres installation during a
particular benchmarking run. Postgres did restart itself nicely though. I
have no idea why that particular run caused problems when all other runs
with identical settings didn't. I checked the log and saw file descriptor
probs. I was doing 128 connections with 128 max connetions. This was the
log:

> 2003-02-12 04:16:15 LOG: PGSTAT: cannot open temp stats file
> /usr/local/pgsql/data/global/pgstat.tmp.41388: Too many open files in
> system
> 2003-02-12 04:16:15 LOG: PGSTAT: cannot open temp stats file
> /usr/local/pgsql/data/global/pgstat.tmp.41388: Too many open files in
> system
> 2003-02-12 04:16:39 PANIC: could not open transaction-commit log
> directory
> (/usr/local/pgsql/data/pg_clog): Too many open files in system
> 2003-02-12 04:16:39 LOG: statement: SET autocommit TO 'on';VACUUM
> ANALYZE
> 2003-02-12 04:16:39 LOG: PGSTAT: cannot open temp stats file
> /usr/local/pgsql/data/global/pgstat.tmp.41388: Too many open files in
> system

This was the MIB:

> kern.maxfiles: 1064
> kern.maxfilesperproc: 957

This was the solution:

> sysctl -w kern.maxfiles=65536
> sysctl -w kern.maxfilesperproc=8192
>
> .. and then stick
>
> kern.maxfiles=65536
> kern.maxfilesperproc=8192
>
> in /etc/sysctl.conf so its set during a reboot.

Which just goes to highlight the importance of rigorously testing a
production installation...

Chris

In response to

Browse pgsql-advocacy by date

  From Date Subject
Next Message Christopher Kings-Lynne 2003-02-13 01:47:28 Re: Changing the default configuration (was Re:
Previous Message Peter Eisentraut 2003-02-12 23:52:25 Re: [HACKERS] Changing the default configuration (was Re:

Browse pgsql-hackers by date

  From Date Subject
Next Message Christopher Kings-Lynne 2003-02-13 01:46:30 Re: Incremental backup
Previous Message Christopher Kings-Lynne 2003-02-13 01:37:16 Re: location of the configuration files

Browse pgsql-performance by date

  From Date Subject
Next Message Christopher Kings-Lynne 2003-02-13 01:47:28 Re: Changing the default configuration (was Re:
Previous Message Peter Eisentraut 2003-02-12 23:52:25 Re: [HACKERS] Changing the default configuration (was Re: