Thread: Re: PHP + Postgres: More than 1000 postmasters produce

Re: PHP + Postgres: More than 1000 postmasters produce

From
"Gellert, Andre"
Date:
Hi Richard,

> Actually it's probably 8kB each = 16MB, but thats between
> *all* the backends.
> You probably want something a fair bit larger than this. Go to
>   http://www.varlena.com/varlena/GeneralBits/Tidbits/index.php
> and read the section on performance tuning and on the annotated
> postgresql.conf

I know this page and I corrected the values according to these hints,
but because of the immense problems ,i set them back to the same
values we use on the old servers.

> You can probably put vaccum_mem back up.

Because it is not rush hour now and i am leaving office for 3 days, I do
this on tuesday , to have a chance to roll back if errors occur.

> So - you let PHP open persistent connections to PG and have
> no limit to the
> number of different connections open at any one time?
> Turn the persistent connections off - you'll probably find
> your problems go away.

I have done this before, but when i remember right, the only effect is,
that every second dozens of postmaster processes started and closed, because
the connection is thrown away. This helps for now, as i can see on "low
traffic" , but when I tried first, we had heavy load just by starting this
large number of processes. There are 5-10 php skripts running per second, in
peeks maybe even twice or more.
This is a problem for the system , when for every process postmaster must be
started, or am I wrong ?

bye
Andre

Re: PHP + Postgres: More than 1000 postmasters produce

From
"scott.marlowe"
Date:
On Fri, 20 Feb 2004, Gellert, Andre wrote:

> I have done this before, but when i remember right, the only effect is,
> that every second dozens of postmaster processes started and closed, because
> the connection is thrown away. This helps for now, as i can see on "low
> traffic" , but when I tried first, we had heavy load just by starting this
> large number of processes. There are 5-10 php skripts running per second, in
> peeks maybe even twice or more.
> This is a problem for the system , when for every process postmaster must be
> started, or am I wrong ?

Actually, most of my scripts spend a LOT more time running PHP and queries
than they do initiating connections.  If you get a chance, profile your
code (microtime() is useful for this) to see where the time is being
spent.  If you see the pg_connect time climbing non-linearly with load,
then you may need to use pg_pconnect.  If the time is climbing linearly
with load and is only a tiny fraction of the amount of time it takes to
run the script, then don't worry about it.


Re: PHP + Postgres: More than 1000 postmasters produce

From
"Gavin M. Roy"
Date:
your pgsql backend must be able to accommodate the max persistent
connections * the max number of apache daemons.

the php pgsql.max_persistent setting is per apache daemon.

HTH,

Gavin

Gellert, Andre wrote:

>Hi Richard,
>
>
>
>>Actually it's probably 8kB each = 16MB, but thats between
>>*all* the backends.
>>You probably want something a fair bit larger than this. Go to
>>  http://www.varlena.com/varlena/GeneralBits/Tidbits/index.php
>>and read the section on performance tuning and on the annotated
>>postgresql.conf
>>
>>
>
>I know this page and I corrected the values according to these hints,
>but because of the immense problems ,i set them back to the same
>values we use on the old servers.
>
>
>
>>You can probably put vaccum_mem back up.
>>
>>
>
>Because it is not rush hour now and i am leaving office for 3 days, I do
>this on tuesday , to have a chance to roll back if errors occur.
>
>
>
>>So - you let PHP open persistent connections to PG and have
>>no limit to the
>>number of different connections open at any one time?
>>Turn the persistent connections off - you'll probably find
>>your problems go away.
>>
>>
>
>I have done this before, but when i remember right, the only effect is,
>that every second dozens of postmaster processes started and closed, because
>the connection is thrown away. This helps for now, as i can see on "low
>traffic" , but when I tried first, we had heavy load just by starting this
>large number of processes. There are 5-10 php skripts running per second, in
>peeks maybe even twice or more.
>This is a problem for the system , when for every process postmaster must be
>started, or am I wrong ?
>
>bye
>Andre
>
>---------------------------(end of broadcast)---------------------------
>TIP 2: you can get off all lists at once with the unregister command
>    (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
>
>