From: | Mel Llaguno <mllaguno(at)coverity(dot)com> |
---|---|
To: | Pavan Deolasee <pavan(dot)deolasee(at)gmail(dot)com> |
Cc: | "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org> |
Subject: | Re: PostgreSQL's share_buffer calculation using shmget() versus kernel.shmmax |
Date: | 2013-02-07 05:31:18 |
Message-ID: | E1FB7FBAE29E634FA58D6CC0D59F288B11EF73B5@CH1PRD0511MB442.namprd05.prod.outlook.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin |
Pavan,
Thanks for your reply. I agree with your statement that you should set the configuration parameters first, but I would like to be able to calculate the SHMMAX value based on those parameters. This is particularly useful when suggesting postgresql.conf optimizations to our customers whose machine have a lot of RAM (64+GB). Having to guess this value is far from ideal; what I'd like is the formula used by postgresql that generates the shmget() value displayed in the pgctl.log.
Thanks,
Mel
________________________________________
From: Pavan Deolasee [pavan(dot)deolasee(at)gmail(dot)com]
Sent: Wednesday, February 06, 2013 10:12 PM
To: Mel Llaguno
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: [ADMIN] PostgreSQL's share_buffer calculation using shmget() versus kernel.shmmax
On Thu, Feb 7, 2013 at 6:28 AM, Mel Llaguno <mllaguno(at)coverity(dot)com> wrote:
> All,
>
> I'm wondering about how postgresql calculates the value for shared buffers
> as I see some discrepancies with what the following script provides versus
> what is recommended in the pgctl.log when the database fails to start.
>
> #!/bin/bash
> # simple shmsetup script
> page_size=`getconf PAGE_SIZE`
> phys_pages=`getconf _PHYS_PAGES`
> shmall=`expr $phys_pages / 2`
> shmmax=`expr $shmall \* $page_size`
> echo kernel.shmmax = $shmmax
> echo kernel.shmall = $shmall
>
> Any pointers which would explain these differences would be greatly
> appreciate. Ultimately, I'd like to calculate the expected kernel.shmmax
> which matches postgresql's shmget() call.
>
I don't know where you got hold of this script, but it seems this is
setting SHMMAX equal to half the size of RAM. So if your system has
4GB RAM, a process can request maximum of 2GB of shared memory. The
amount of shared memory PostgreSQL needs is governed by several
configuration parameters, but the most important and the one which
will eat up most of that shared memory is "shared_buffers". So if you
want to work within the bounds of SHMMAX set by this script, you would
need to set shared_buffers a notch lower than that. But often its
easier and better to decide your Postgres configuration parameters and
then set SHMMAX to satisfy that.
Thanks,
Pavan
--
Pavan Deolasee
http://www.linkedin.com/in/pavandeolasee
From | Date | Subject | |
---|---|---|---|
Next Message | Pavan Deolasee | 2013-02-07 05:41:46 | Re: PostgreSQL's share_buffer calculation using shmget() versus kernel.shmmax |
Previous Message | Pavan Deolasee | 2013-02-07 05:12:49 | Re: PostgreSQL's share_buffer calculation using shmget() versus kernel.shmmax |