Thread: Default shared memory SGML mention

Default shared memory SGML mention

From
Bruce Momjian
Date:
I am looking over the shared memory SGML files, and found that on my
BSD/OS system, I get as the following default shared memory size:

m       131072      5432001 --rw------- postgres     user postgres
user      1 1236992  10622  10622 12:11:14 12:11:15 12:11:14

            ^^^^^^^

I have highlighted the size.  If I subtract the default shared memory
buffers, I get:

    1236992 - 8192 * 64

    712704

so by my computations, we need about 700k added to the shared buffer
cache area.  The documentation says to add 512k, not 700k.  My guess is
that the non-cached shared memory area has increased in a recent
release, and docs were not updated.  I will bump up the SGML mention to
700k unless someone shows a lower default shared memory size.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Re: Default shared memory SGML mention

From
Tom Lane
Date:
Bruce Momjian <pgman@candle.pha.pa.us> writes:
> so by my computations, we need about 700k added to the shared buffer
> cache area.  The documentation says to add 512k, not 700k.

This would depend on your -N setting.

A little experimentation shows that the present multiplier for -B is
about 8350 bytes and the multiplier for -N about 14580 bytes on my
system (HPUX), which extrapolates to a fixed base of about 250K plus
the -B and -N contributions.  In reality I believe the computation
is somewhat nonlinear, but that's probably close enough for starters.

            regards, tom lane

Re: Default shared memory SGML mention

From
Bruce Momjian
Date:
> Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > so by my computations, we need about 700k added to the shared buffer
> > cache area.  The documentation says to add 512k, not 700k.
>
> This would depend on your -N setting.
>
> A little experimentation shows that the present multiplier for -B is
> about 8350 bytes and the multiplier for -N about 14580 bytes on my
> system (HPUX), which extrapolates to a fixed base of about 250K plus
> the -B and -N contributions.  In reality I believe the computation
> is somewhat nonlinear, but that's probably close enough for starters.

I have updated the SGML sources to say for default shared memory values:

    250 kB + 8192 * buffers or infinity

Of course, buffers is 2 * connections by default.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Re: Default shared memory SGML mention

From
Bruce Momjian
Date:
> Bruce Momjian <pgman@candle.pha.pa.us> writes:
> >> A little experimentation shows that the present multiplier for -B is
> >> about 8350 bytes and the multiplier for -N about 14580 bytes on my
> >> system (HPUX), which extrapolates to a fixed base of about 250K plus
> >> the -B and -N contributions.  In reality I believe the computation
> >> is somewhat nonlinear, but that's probably close enough for starters.
>
> > I have updated the SGML sources to say for default shared memory values:
>
> >     250 kB + 8192 * buffers or infinity
>
> How did infinity get into this?  And what happened to the -N
> contribution?

Infinity was always there.  The column is labeled "Typical Values".  As
far as -N, buffers is always 2*N, right, so I figured it was in there
already.


--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Re: Default shared memory SGML mention

From
Tom Lane
Date:
Bruce Momjian <pgman@candle.pha.pa.us> writes:
>> A little experimentation shows that the present multiplier for -B is
>> about 8350 bytes and the multiplier for -N about 14580 bytes on my
>> system (HPUX), which extrapolates to a fixed base of about 250K plus
>> the -B and -N contributions.  In reality I believe the computation
>> is somewhat nonlinear, but that's probably close enough for starters.

> I have updated the SGML sources to say for default shared memory values:

>     250 kB + 8192 * buffers or infinity

How did infinity get into this?  And what happened to the -N
contribution?

            regards, tom lane

Re: Default shared memory SGML mention

From
Tom Lane
Date:
Bruce Momjian <pgman@candle.pha.pa.us> writes:
> far as -N, buffers is always 2*N, right, so I figured it was in there
> already.

No, it isn't, and buffers is NOT always 2*N.

            regards, tom lane

Re: Default shared memory SGML mention

From
Bruce Momjian
Date:
> Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > far as -N, buffers is always 2*N, right, so I figured it was in there
> > already.
>
> No, it isn't, and buffers is NOT always 2*N.

Yes, but shared memory limits are based on buffers, not connections,
right?  The per-connection overhead is pretty small, no?

If it is buffers and connections, how much is connections and how much
buffers.  I know buffers is 8k.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Re: Default shared memory SGML mention

From
Tom Lane
Date:
Bruce Momjian <pgman@candle.pha.pa.us> writes:
> Yes, but shared memory limits are based on buffers, not connections,
> right?  The per-connection overhead is pretty small, no?

I gave you my experimentally-derived formula already:

    250Kb + 8350 * B + 14580 * N

I don't see how you can consider the N term negligible.

            regards, tom lane

Re: Default shared memory SGML mention

From
Bruce Momjian
Date:
> Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > Yes, but shared memory limits are based on buffers, not connections,
> > right?  The per-connection overhead is pretty small, no?
>
> I gave you my experimentally-derived formula already:
>
>     250Kb + 8350 * B + 14580 * N
>
> I don't see how you can consider the N term negligible.

Oh, I misread it.  I thought the 14.5k was part of the 250k.  Let me fix
that.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Re: Default shared memory SGML mention

From
Bruce Momjian
Date:
> Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > Yes, but shared memory limits are based on buffers, not connections,
> > right?  The per-connection overhead is pretty small, no?
>
> I gave you my experimentally-derived formula already:
>
>     250Kb + 8350 * B + 14580 * N
>
> I don't see how you can consider the N term negligible.

OK, patch applied.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026
Index: doc/src/sgml/runtime.sgml
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/doc/src/sgml/runtime.sgml,v
retrieving revision 1.64
diff -c -r1.64 runtime.sgml
*** doc/src/sgml/runtime.sgml    2001/05/07 15:55:27    1.64
--- doc/src/sgml/runtime.sgml    2001/05/08 21:09:21
***************
*** 1481,1487 ****
        <row>
         <entry><varname>SHMMAX</></>
         <entry>Maximum size of shared memory segment (bytes)</>
!        <entry>250 kB + 8192 * buffers or infinity</entry>
        </row>

        <row>
--- 1481,1487 ----
        <row>
         <entry><varname>SHMMAX</></>
         <entry>Maximum size of shared memory segment (bytes)</>
!        <entry>250 kB + 8.2kB * buffers + 14.2kB * max_connections or infinity</entry>
        </row>

        <row>