Uutiset:

Wondering if this will always be free?  See why free is better.

Main Menu
Advertisement:

mySQL "too many connections" error

Aloittaja trlacey, helmikuu 14, 2005, 06:43:59 AP

« edellinen - seuraava »

trlacey

Hello,

I've written my own Webserver to handle PHP ISAPI.  In the Server I call PHP ISAPI in a new Thread each time there's a PHP request.  The Thread shuts down when the request has been completed.

With max connections set to 100 in my.ini and "persistent connections" on, I get a "too many connections" error after accessing the website about 15 or 20 times.  If I up the max connections setting to 250, the same thing happens, but not as soon.  When the error comes up, refreshing doesn't help.  The only way to get rid of the error message is to stop and restart the SQL Server.

Everytime I check phpinfo, it says that the number of live persistent connections to mySQL is zero (0).

I don't seem to get the error when "persistent connections" is turned off.

Any suggestions you might have would be helpful.

http://www.trlacey.com/Forum/phpinfo.php

Thanks,

Terry

[Unknown]

Well, just remember that persistant connections will mutliply for threads.  They're not the best idea when you have many threads branching out, and they're best when you have a single/unthreaded server.

That said, we use it here with Apache, and max_connections is probably something like 500.

-[Unknown]

trlacey

Thanks Unknown.  So my guess is it opens a new connection for each Thread and never closes it, or reuses it again.  That's what I figured.  But it does seem odd that "Active Persistent Links" is always set to zero in PHP Info.

[Unknown]

Lainaus käyttäjältä: trlacey - helmikuu 14, 2005, 09:32:52 AP
Thanks Unknown.  So my guess is it opens a new connection for each Thread and never closes it, or reuses it again.  That's what I figured.

Basically, yes.  Theoretically, it would eventually go back to thread #1 when it's not busy, and reuse the connection - which is why it can be more efficient.

LainaaBut it does seem odd that "Active Persistent Links" is always set to zero in PHP Info.

I'm afraid I don't know anything about that... :/.

-[Unknown]

trlacey

Lainaus käyttäjältä: [Unknown] - helmikuu 14, 2005, 09:34:27 AP
Basically, yes.  Theoretically, it would eventually go back to thread #1 when it's not busy, and reuse the connection - which is why it can be more efficient.

-[Unknown]

I'm guessing it only allows the same Thread to reuse it's own SQL connection.  Thanks for your help, as always.  And I will Post my other question on the SQL Forum.  The SMF Software is working great BTW.  I'm impressed.

Regards,

Terry

Advertisement: