From: | Greg Smith <greg(at)2ndQuadrant(dot)com> |
---|---|
To: | pgsql-performance(at)postgresql(dot)org |
Subject: | Re: The right SHMMAX and FILE_MAX |
Date: | 2011-05-01 19:38:51 |
Message-ID: | 4DBDB6CB.70002@2ndQuadrant.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-performance |
On 05/01/2011 02:48 AM, Phoenix Kiula wrote:
> Hi. I'm on a 64 Bit CentOS 5 system, quadcore processor, 8GB RAM and
> tons of data storage (1 TB SATAII disks).
>
> The current SHMMAX and SHMMIN are (commas added for legibility) --
>
> kernel.shmmax = 68,719,476,736
> kernel.shmall = 4,294,967,296
>
That's set higher than the amount of RAM in the server. Run the
attached script; it will produce reasonable values for your server,
presuming you'll never want to allocate >50% of the RAM in the server
for shared memory. Given standard tuning for shared_buffers is <40%,
I've never run into a situation where this was a terrible choice if you
want to just set and forget about it. Only reason to fine-tine is if
another major user of shared memory is running on the server
> Now, according to my reading in the PG manual and this list, a good
> recommended value for SHMMAX is
>
> (shared_buffers * 8192)
>
The value for shared_buffers stored internally is in 8192 byte pages:
select setting,unit,current_setting(name) from pg_settings where
name='shared_buffers';
setting | unit | current_setting
---------+------+-----------------
4096 | 8kB | 32MB
So any formula you found that does this sort of thing is just converting
it back to bytes again, and is probably from an earlier PostgreSQL
version where you couldn't set this parameter in memory units. SHMMAX
needs to be a bit bigger than shared_buffers in bytes.
> Similarly with "fs.file_max". There are articles like this one:
> http://tldp.org/LDP/solrhe/Securing-Optimizing-Linux-RH-Edition-v1.3/chap6sec72.html
> Is this relevant for PostgreSQL performance at all, or should I skip that?
>
That's ancient history. This is how big the default is on the two Linux
distributions I have handy:
[RHEL5]
$ cat /proc/sys/fs/file-max
745312
[Debian Squeeze]
$ cat /proc/sys/fs/file-max
1645719
It was a tiny number circa the RedHat 6 that manual was written for, now
it's very unlikely you'll exceed the kernel setting here.
--
Greg Smith 2ndQuadrant US greg(at)2ndQuadrant(dot)com Baltimore, MD
PostgreSQL Training, Services, and 24x7 Support www.2ndQuadrant.us
"PostgreSQL 9.0 High Performance": http://www.2ndQuadrant.com/books
Attachment | Content-Type | Size |
---|---|---|
shmsetup | text/plain | 915 bytes |
From | Date | Subject | |
---|---|---|---|
Next Message | Greg Smith | 2011-05-01 23:31:15 | Re: stored proc and inserting hundreds of thousands of rows |
Previous Message | Kevin Grittner | 2011-05-01 17:18:50 | Re: The right SHMMAX and FILE_MAX |