Skip site navigation (1) Skip section navigation (2)

Re: Shared memory usage calculations

From: Thom Brown <thombrown(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-docs(at)postgresql(dot)org
Subject: Re: Shared memory usage calculations
Date: 2009-10-10 14:29:31
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-docs
2009/10/10 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>

> Thom Brown <thombrown(at)gmail(dot)com> writes:
> > I've had a look at the documentation for how much shared memory (in
> bytes)
> > Postgres uses:
> >
> > However, after using these calculations to work out the shared memory
> usage
> > for my own setup, the numbers I came up with are clearly wrong.
> Clearly wrong compared to what --- ie, what's the actual size of your
> shared memory segment?  (See ipcs)

I don't actually know the size of my shared memory segment.  "sysctl -a |
grep -i shmseg" doesn't return anything as it hasn't been set, and not sure
how to find out the default value.  I didn't see that mentioned in the
calculations so I didn't take it into account anywhere.  But 1.7TB shared
memory can't be right as the entire system memory is only 720MB.

> > If I convert the sizes to kilobytes instead of bytes, it shows a total
> value
> > of 47 megabytes, which, while not extreme, looks too low.  And I am
> > surprised that max_connections has relatively little bearing on the
> shared
> > memory requirements.  Is this right, or should is it more a case of it
> > affecting semaphores?  I was under the impression that the maximum number
> of
> > connections played a large role in deciding shared memory limits.
> No, it doesn't really ... shared_buffers is the first-order component.
> Also, I'm not sure whether you realize that the native unit for these
> numbers is mostly *not* bytes.
> > shared_buffers = 196000000 (196MB)
> > wal_buffers = 8000000 (8MB)
> Neither of those parenthetical remarks are correct if that's exactly
> what you wrote in postgresql.conf.  It might be worth checking the
> way these values are displayed in pg_settings.

The parenthesised values are what I have in postgresql.conf.  I take it
these are supposed to be mebibytes then?  When I check the value in
pg_settings, it's set at 25088 with the unit set at 8kB is 196 mebibytes.
 It also shows wal_buffers at 1024 with 8kB units, which would be 8

I gather I'm calculating the final value wrong though. :/


In response to


pgsql-docs by date

Next:From: Tom LaneDate: 2009-10-10 18:39:38
Subject: Re: Shared memory usage calculations
Previous:From: Tom LaneDate: 2009-10-10 13:57:33
Subject: Re: Shared memory usage calculations

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group