Home > Archive > PostgreSQL Discussion > May 2005 > Postgres PHP error









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Postgres PHP error
Shaun Clements

2005-05-23, 9:23 am

Hi All

Im receiving the following error, on a php page, conneting to postgres 7.4,
installed on Mandrake 10.0
<snip>
Error Description: pg_connect(): Unable to connect to PostgreSQL server:
FATAL: sorry, too many clients already .
</snip>
Can anyone tell me what this means?
Is there a performance setting I need to set under the postgresql conf file.
I have checked, and its set to 100 users.
This error strangely has only happened once. Last week Monday.

Kind Regards,
Shaun Clements

Richard Huxton

2005-05-23, 9:23 am

Shaun Clements wrote:
> Hi All
>
> Im receiving the following error, on a php page, conneting to postgres 7.4,
> installed on Mandrake 10.0
> <snip>
> Error Description: pg_connect(): Unable to connect to PostgreSQL server:
> FATAL: sorry, too many clients already .
> </snip>
> Can anyone tell me what this means?


It means exactly what it says - too many clients.

> Is there a performance setting I need to set under the postgresql conf file.
> I have checked, and its set to 100 users.
> This error strangely has only happened once. Last week Monday.


Well - you probably had 100 connections then (actually, 100 - your
superuser reserved connections, default=2).

There are two possibilities:
1. You had 100 users last Monday
2. You are using more than one connection per user.

The second is the most likely. Turn connection logging on and try with a
couple of users to see how many connections you generate as you use the
site.

--
Richard Huxton
Archonet Ltd

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere
" to majordomo@postgresql
.org)

Shaun Clements

2005-05-23, 9:23 am

Thanks. Great idea.
I assume there is more than one connection per user.
As judging by the scope of the system, more than one connection is made.
Would you suggest I increase the size of the connections.
What kind of performance decrease would I see, even if 100 isnt always used.

Kind Regards,
Shaun Clements

-----Original Message-----
From: Richard Huxton & #91;mailto:dev@archo
net.com]
Sent: 23 May 2005 03:29 PM
To: Shaun Clements
Cc: 'pgsql-general@postgresql.org'
Subject: Re: [GENERAL] Postgres PHP error

Shaun Clements wrote:
> Hi All
>
> Im receiving the following error, on a php page, conneting to postgres
> 7.4, installed on Mandrake 10.0 <snip> Error Description:
> pg_connect(): Unable to connect to PostgreSQL server:
> FATAL: sorry, too many clients already .
> </snip>
> Can anyone tell me what this means?


It means exactly what it says - too many clients.

> Is there a performance setting I need to set under the postgresql conf

file.
> I have checked, and its set to 100 users.
> This error strangely has only happened once. Last week Monday.


Well - you probably had 100 connections then (actually, 100 - your superuser
reserved connections, default=2).

There are two possibilities:
1. You had 100 users last Monday
2. You are using more than one connection per user.

The second is the most likely. Turn connection logging on and try with a
couple of users to see how many connections you generate as you use the
site.

--
Richard Huxton
Archonet Ltd

Richard Huxton

2005-05-23, 9:23 am

Shaun Clements wrote:
> Thanks. Great idea.
> I assume there is more than one connection per user.
> As judging by the scope of the system, more than one connection is made.
> Would you suggest I increase the size of the connections.
> What kind of performance decrease would I see, even if 100 isnt always used.


It doesn't cost a lot to have many idle connections.

However - I'd still be tempted to see if the PHP application can't be
tweaked to reduce the time it spends with an open connection. It's
probably a case that scripts are opening connections, making one short
query and leaving the connection open unnecessarily after they've
finished with it.

--
Richard Huxton
Archonet Ltd

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere
" to majordomo@postgresql
.org)

Matthew Terenzio

2005-05-23, 11:23 am

I f you are using Apache, also check the max connections in the
httpd.conf. You really can't allow more apache children than your max
number of Postgres connections. At least it solved the problem in my
case.

On May 23, 2005, at 9:47 AM, Richard Huxton wrote:

> Shaun Clements wrote:
>
> It doesn't cost a lot to have many idle connections.
>
> However - I'd still be tempted to see if the PHP application can't be
> tweaked to reduce the time it spends with an open connection. It's
> probably a case that scripts are opening connections, making one short
> query and leaving the connection open unnecessarily after they've
> finished with it.
>
> --
> Richard Huxton
> Archonet Ltd
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere
" to majordomo@postgresql
.org)
>




---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com