List:General Discussion« Previous MessageNext Message »
From:Michael Dykman Date:September 19 2008 4:35pm
Subject:Re: too many connections
View as plain text  
PHP provides both msql_connect and mysql_pconnect.  The former does
indeed create a new connection to process each request and closes it
auto-magically upon completion.  The latter creates a rather
half-assed connection pool; once a connection is allocated by PHP, it
is held open and reused for subsequent requests.  New connections are
created if no persistent connection is available.   Unfortunately,
connections allocated though mysql_pconnect are never closed.  If the
rate of requests should spike, PHP will potentially allocate every
connection and never release them, even after traffic returns to
normal, which counter-indicates using the method for any pratiacl web
application.  Most developers/admins prefer to take the hit and use
mysql_connect, opening and closing a connection for each request
rather than risk having all connections consumed.


 - michael dykman
On Fri, Sep 19, 2008 at 12:07 PM, Olexandr Melnyk <omelnyk@stripped> wrote:
> In case you're using PHP, in theory all database connections should be
> closed when script stops execution. I'm not sure if it's always like that in
> practice.
>
> Persistent connections can be a quick fix to your problem, but as was
> mentioned in the previous mail, it's better to find out why there's so
> many of them.
>
> On 9/19/08, Gary W. Smith <gary@stripped> wrote:
>>
>> Gail,
>>
>> I know the list has already recommended allowing more connections but the
>> bigger question is what is sucking them all up.  Even with 1000 connections
>> things like apache can only use the number of connections that there are
>> processes (* the number of connections used within each process).
>>
>> As a fast workaround, increase the connections but for a long term solution
>> you really need to find out what the problem is, now how to work around it.
>>
>> Gary
>>
>>
>>
>> ________________________________
>>
>> From: Kinney, Gail [mailto:Gail.Kinney@stripped]
>> Sent: Fri 9/19/2008 8:33 AM
>> To: 'mysql@stripped'
>> Subject: too many connections
>>
>>
>>
>>
>> Hello,  We have MySQL 4.0.14 and have just gotten an error:  too many
>> connections.  we can't connect to our site using MySQL admin.  Please help.
>>
>> Gail Kinney
>> Webmaster UC Denver
>> gail.kinney@stripped<mailto:gail.kinney@stripped>
>>
>>
>>
>>
>
>
> --
> Sincerely yours,
> Olexandr Melnyk
> http://omelnyk.net/
>



-- 
 - michael dykman
 - mdykman@stripped

 - All models are wrong. Some models are useful.
Thread
too many connectionsGail Kinney19 Sep
  • Re: too many connectionsOlexandr Melnyk19 Sep
    • Re: too many connectionsMadan Thapa19 Sep
  • Re: too many connectionsJake Peavy19 Sep
  • RE: too many connectionsGary W. Smith19 Sep
    • Re: too many connectionsOlexandr Melnyk19 Sep
      • Re: too many connectionsMichael Dykman19 Sep
RE: too many connectionsMartin Gainty19 Sep
Re: too many connectionsOlexandr Melnyk19 Sep
Re: too many connectionsJaime Fuentes19 Sep
  • Re: too many connectionsBrent Baisley19 Sep
    • Re: too many connectionschandru20 Sep