Re: PostgreSQL BSDI BSD/OS port

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема Re: PostgreSQL BSDI BSD/OS port
Дата
Msg-id 200007071920.PAA03075@candle.pha.pa.us
обсуждение исходный текст
Ответ на PostgreSQL BSDI BSD/OS port  ("David J. MacKenzie" <djm@web.us.uu.net>)
Ответы Re: PostgreSQL BSDI BSD/OS port  ("David J. MacKenzie" <djm@web.us.uu.net>)
Список pgsql-ports
I have already fixed the LC_MESSAGES issue for 7.1.

I have made a new BSDI item #3 for your semaphore changes.  I did not
make the shared memory changes you suggested because it requires changes
to the kernel include files and the config files.  I prefer suggestting
the change only in one place.  If it were not for the requirement of
#ifndef, I would prefer the config file change.

New BSDI FAQ version attached:

> Some corrections for the BSD/OS port.  BSD/OS doesn't define
> LC_MESSAGES, so that needs to be ifdef'd, and the kernel tuning
> parameters are incomplete and suboptimal.
>
> Index: src/backend/utils/adt/pg_locale.c
> ===================================================================
> RCS file: /export/src/CVS/usr.local/bin/postgresql-7.0/src/backend/utils/adt/pg_locale.c,v
> retrieving revision 1.1
> retrieving revision 1.2
> diff -u -r1.1 -r1.2
> --- src/backend/utils/adt/pg_locale.c    2000/06/30 21:15:43    1.1
> +++ src/backend/utils/adt/pg_locale.c    2000/06/30 22:51:00    1.2
> @@ -40,7 +40,9 @@
>      lc->lc_time = setlocale(LC_TIME, NULL);
>      lc->lc_collate = setlocale(LC_COLLATE, NULL);
>      lc->lc_monetary = setlocale(LC_MONETARY, NULL);
> +#ifdef LC_MESSAGES
>      lc->lc_messages = setlocale(LC_MESSAGES, NULL);
> +#endif /* LC_MESSAGES */
>
>      return lc;
>  }
> @@ -62,7 +64,11 @@
>           lc->lc_time,
>           lc->lc_collate,
>           lc->lc_monetary,
> +#ifdef LC_MESSAGES
>           lc->lc_messages
> +#else /* LC_MESSAGES */
> +         "unimplemented"
> +#endif /* LC_MESSAGES */
>      );
>
>      return lc;
> @@ -92,8 +98,10 @@
>      if (!setlocale(LC_MONETARY, lc->lc_monetary))
>          elog(NOTICE, "pg_setlocale(): 'LC_MONETARY=%s' cannot be honored.", lc->lc_monetary);
>
> +#ifdef LC_MESSAGES
>      if (!setlocale(LC_MESSAGES, lc->lc_messages))
>          elog(NOTICE, "pg_setlocale(): 'LC_MESSAGE=%s' cannot be honored.", lc->lc_messages);
> +#endif /* LC_MESSAGES */
>
>      return lc;
>  }
>
> Index: doc/FAQ_BSDI
> ===================================================================
> diff -u -r1.1 -r1.2
> --- doc/FAQ_BSDI    2000/06/30 21:15:35    1.1
> +++ doc/FAQ_BSDI    2000/07/07 14:23:18    1.2
> @@ -8,12 +8,49 @@
>
>  ---------------------------------------------------------------------------
>
> +You may need to increase the number of sysv semaphores.
> +PostgreSQL 7 allowing the default number of backend connections
> +allocates 32 semaphores, which is just over half the default system
> +total of 60.
> +
> +The defaults are in /sys/sys/sem.h:
> +
> +/* Configuration parameters */
> +#ifndef SEMMNI
> +#define SEMMNI  10              /* # of semaphore identifiers */
> +#endif
> +#ifndef SEMMNS
> +#define SEMMNS  60              /* # of semaphores in system */
> +#endif
> +#ifndef SEMUME
> +#define SEMUME  10              /* max # of undo entries per process */
> +#endif
> +#ifndef SEMMNU
> +#define SEMMNU  30              /* # of undo structures in system */
> +#endif
> +
> +Set the values you want in your kernel config file, e.g.:
> +
> +options "SEMMNI=40"
> +options "SEMMNS=240"
> +options "SEMUME=40"
> +options "SEMMNU=120"
> +
> +---------------------------------------------------------------------------
> +
>  Increase SHMMAXPGS by 1024 for every additional 4MB of shared
>  memory:
>
>  /sys/sys/shm.h:69:#define       SHMMAXPGS       1024    /* max hardware pages...
>
>  The default setting of 1024 is for a maximum of 4MB of shared memory.
> +PostgresSQL 7 allowing the default number of backend connections
> +allocates about 1.2MB of shared memory.
> +
> +Enclose the above line with "#ifndef SHMMAXPGS" and "#endif", and in
> +your kernel config file set the desired value, e.g.:
> +
> +options "SHMMAXPGS=8192"
>
>  For those running 4.1 or later, just recompile the kernel and reboot.
>  For those running earlier releases, there are more steps outlined below.
> @@ -24,11 +61,17 @@
>  This is computed dynamically at bootup.
>
>      $ bpatch -r sysptsize
> -    0x9 = 9
> +    0x16 = 22
>
> -Next, change SYSPTSIZE to a hard-coded value.  Use the bpatch value,
> -plus add 1 for every additional 4MB of shared memory you desire.
> +Set SYSPTSIZE in your kernel config file, e.g.:
>
> +options "SYSPTSIZE=29"
> +
> +Use the bpatch value, plus add 1 for every additional 4MB of shared
> +memory you desire.  For reference, the default is set here:
> +
>  /sys/i386/i386/i386_param.c:28:#define  SYSPTSIZE 0        /* dynamically...
>
>  sysptsize can not be changed by sysctl on the fly.
> +
> +---------------------------------------------------------------------------
>


--
  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
This outlines modifications to BSD/OS for running PostgreSQL:

1)  How to increase resource limits
2)  How to increase the number of shared memory buffers
3)  How to increasing the number of semaphores

Bruce Momjian (pgman@candle.pha.pa.us)  2000-07-7

---------------------------------------------------------------------------

1)  To increase the amount of malloc'ed memory and files opened by
PostgreSQL, add this:

          :datasize-cur=600M:\
          :openfiles-cur=256:

to your /etc/login.conf file.

---------------------------------------------------------------------------

2a)  By default, only 4MB of shared memory is supported by BSDI. Keep in
mind that shared memory is not pageable.  It is locked in RAM.

To increase the number of buffers supported by the postmaseter, increase
SHMMAXPGS by 1024 for every additional 4MB of shared memory:

/sys/sys/shm.h:69:#define       SHMMAXPGS       1024    /* max hardware pages...

The default setting of 1024 is for a maximum of 4MB of shared memory.

For those running 4.1 or later, just recompile the kernel and reboot.
For those running earlier releases, see step 2b.

---------------------------------------------------------------------------

2b)  For 4.01 and earlier, use bpatch to find the sysptsize value for
the current kernel.  This is computed dynamically at bootup.

    $ bpatch -r sysptsize
    0x9 = 9

Next, change SYSPTSIZE to a hard-coded value.  Use the bpatch value,
plus add 1 for every additional 4MB of shared memory you desire.

/sys/i386/i386/i386_param.c:28:#define  SYSPTSIZE 0        /* dynamically...

sysptsize can not be changed by sysctl on the fly.

---------------------------------------------------------------------------

3)  How to increasing the number of semaphores.

You may need to increase the number of sysv semaphores. By default,
PostgreSQL allocates 32 semaphores, one for each backend connection.
This is just over half the default system total of 60.

The defaults are in /sys/sys/sem.h:

/* Configuration parameters */
#ifndef SEMMNI
#define SEMMNI  10              /* # of semaphore identifiers */
#endif
#ifndef SEMMNS
#define SEMMNS  60              /* # of semaphores in system */
#endif
#ifndef SEMUME
#define SEMUME  10              /* max # of undo entries per process */
#endif
#ifndef SEMMNU
#define SEMMNU  30              /* # of undo structures in system */
#endif

Set the values you want in your kernel config file, e.g.:

options "SEMMNI=40"
options "SEMMNS=240"
options "SEMUME=40"
options "SEMMNU=120"


В списке pgsql-ports по дате отправления:

Предыдущее
От: "Frederic De Leersnijder"
Дата:
Сообщение: can not guess host type
Следующее
От: "David J. MacKenzie"
Дата:
Сообщение: Re: PostgreSQL BSDI BSD/OS port