Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

connection issue to mysql

Status
Not open for further replies.

ajji

Programmer
Mar 26, 2002
12
FR
Hi,

I got a setup of mysql/apache/php running on my home server. The server is not the most powerfull 1Go of memory 2.66 Ghz cpu, and a 2Mbits bandwith. It is running under Fedora core 3.
This should still be enough for the hosting of my home website and forum...

the issue I have is that often during the evening the connection to mysql failed for some users and for me as well from time to time. It is happening mainly when there is many visitors on the forum (100 or more)

The error message is the following :
PHP Warning: mysql_connect(): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (11) in /var/ on line 30

Do you have any idea of the reason of this problem? to reproduce the issue it is easy i just have to try running the apache benchmark :
ab -c 50 -n 5000 -A "admin:btd3txwn"
this is really annoying for the visitors of my website and it seems that this is also happening on some other website : doing a google search with mysql.sock' (11) show many results ... but no answers !

thank you in advance for your help.
 
Check the max allowed connections:

mysql -e "show variables like '%connections'"

I think the default is 100. You can change it to at least the value of Apache's MaxClients by editing my.cnf and adding:

set-variable = max_connections=300 (for example)




 
Thanks for your reply

the apache and mysql configuration file should be able to support such a load without an trouble, mysql is set for 256 and apache as well I also tested with 500 and it doesn't help.
When the mas connection is too low the log message is : too many connections .

In my case the issue is different and might concerns other configuration varaible...
When doing show status I can see that the maximum connections used is 106 so it is bellow the setting in my.cnf.
I was more thinking about the number of file descriptors of my linux box and in the my.cnf but after putting the max file to 8592 this didn't change anything either.

The memory usage should not be responsible of the issue last itme I notice this connection failure I was having 226Mo of memory free...

Any other ideas ? It seems that this issue is not difficult to reproduce by searching on google many other php/mysql site got it.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top