Connection to MySql gets lost
Hello,
I have been experiencing the following problem:
Once in a while, php is unable to connect to the MySql server.
Then after a few seconds of minutes, it does connect again.
I'm not sure if it's a PHP issue or a MySql.
I use fcgi for PHP.
Any ideas?
It should be an mysql issue.
When php is unable to connct to mysql, i try to connect to mysql using mysql administrator, and i get:
Can't create new thread (errno 12)
Any ideas?
Hi,
This seems like a simple problem. It's most likely one of your configuration directives.
Check out some of the "research" I did here, on MySQL configuration directives.
These particular articles might help:
http://www.sitebuddy.com/MySQL/thread_cache_size/thread_concurrency
http://www.sitebuddy.com/MySQL/max_allowed_packet/max_connections/Wait_timeout
2 main ideas:
1) Remove persistent MySQL connections from your php.ini (even if this works I recommend you see point 2), to determine exactly which resource is limited. It important to have a stable system to know its "weak points").
http://www.sitebuddy.com/PHP/mysql/Persistent/Database/Connections
2) You have limited resources.
Two principals here:
2.1) Try to increase the available resources (threads, connections ...etc...)
2.2) Try to decrease the amount of time a resource is allocated (time out type values should be decreased).
Let us know when you find the exact param that fixed your issue.
Good luck.
Chris
Chris,
Thank you alot for your informative reply.
I will proceed to your suggestions, and post results on this thread!
Thx
al
Hello again...
Getting back to this.
Unfortunately i still haven't solved this issue. It appears very often. And as my database grows larger, it appears more often.
I did everything that you suggested, but it just didn't seem to help...
Here's a screenshot from Mysql administrator...
http://img100.imageshack.us/my.php?image=mysqlthreadsdm7.gif
Isn't weird that i have no thread cached?
Thanx!
THat's more like it!
http://img144.imageshack.us/my.php?image=mysqlthreadsgoodsv1.gif
I raised wait_timeout down to 180.
This guy here had a similar issue:
http://jeremy.zawodny.com/blog/archives/000173.html
I will post results
I have a pretty active Mysql running multiple clients.
Here are the values I currently have:
Threads_cached: 5
Threads_connected: 1
Threads_created: 6
Threads_running: 1
It's also 1:30 am so that explain why those values are so low.
So the basic principal here appears to be:
1) decrease the timeout value
2) increase the thread cache.
Looks like:
wait_timeout=15;
thread_cache_size=40;
work well for him.
Cheers,
Chris

delicious
digg
reddit
google
technorati
Joined: 2006-08-30