constant mysql connection issues?

fkatzenb

Well-Known Member
Sep 23, 2009
216
0
66
Lusby, Maryland, United States
cPanel Access Level
Root Administrator
I have been noticing that MySQL disconnects one a periodic basis. Of course I primarily notice through the email notices from my CB forums. But that means people are being directed to the error page. Not something I like to see. Suggestions?
 

WiredTree Joe

Well-Known Member
Dec 13, 2006
68
1
158
Chicago, IL
Most forum software can report the exact error being given, but you might be hitting your mySQL max connections. Check your /etc/my.cnf for low values on:

Code:
max_user_connections=25
max_connections=300
Very active forums can use a lot of connection slots under high concurrent usage. Raising those values and restarting mySQL is a good thing to try out. Don't raise them too high as those limits are in place for a reason. Setting them too high can run you out of server resources very quickly. Without knowing the exact error this is no more than a guess at the cause of the issue, but it might point you in the right direction.
 

MaestriaNick

Well-Known Member
Aug 6, 2008
159
3
68
This is most likely due to the script not closing connections to mysql properly or is getting too busy at times. There is a 25 (max_user_connections) concurrent mysql connection limit which is good for around 100 simultaneous visits on well written scripts. If a script is keeping connections open then obviously 25 concurrent connections do not go far and some of your visitors would see an error.
 

xerophyte

Well-Known Member
Mar 16, 2003
215
0
166
Canada
Install munin and mysql plugin to monitor the mysql server and get stats out of it. Then try to make a decision from the graphs. You can also try tunning-primer.sh to get draft idea about your mysql system variables setting .. hope that helps
 

fkatzenb

Well-Known Member
Sep 23, 2009
216
0
66
Lusby, Maryland, United States
cPanel Access Level
Root Administrator
Thanks for the info. Outside of those random notices, there has been no degraded performance. I did find in the log that eximstat/smtp was corrupted. I repaired that and I haven't received another notice. I will keep watching. I just wished logwatch would monitor mysql.

Thanks,
Frank