0

I have a php function ( "mconnect") for connecting to mysql . Sometimes in full load i get a blank page with "[]mconnect: mysql_connect"
In this function i have custom messages for mysql error 1040 and 2002 -- connection errors
In logs nothing appears when this error occur
I use lighttpd 1.4.28 with php-cgi 5.2.0 and mysql 5.0.32 debian etch

Those blank pages with error appears only in full load : when mysql has Avg. questions per second = 586.39 and lighty ~300 conn/s
Both, lighty and mysql share the same machine: dual quad xeon with 8G ram

If anyone has a clue, please share

Thanks
Cris

OMG Ponies
  • 325,700
  • 82
  • 523
  • 502
cris
  • 13
  • 3

1 Answers1

0

You could increase MySQLs connection limit, like pointed out in this article: http://rackerhacker.com/2007/01/24/increase-mysql-connection-limit/

But it would be good if you also had a look over different performance tunning like query caching and the like. As well information I have found on the same website. http://rackerhacker.com/2008/06/24/mysql-error-1040-too-many-connections/

But the best approach would be to limit the number of database accesses from your application, have some caching in place and do the minimal connections to your database.

mhitza
  • 5,709
  • 2
  • 29
  • 52
  • Connection limit is very high , and i use querry cache. Is a production server with many writes. Error 1040 or 2002 has a custom error mesage in our application, when occur. This error i don't know what it is..this is my question – cris Oct 21 '10 at 21:39
  • Possibly related http://stackoverflow.com/questions/2996976/are-mysql-close-and-pg-close-required – mhitza Oct 21 '10 at 22:02
  • I don't think, because php-cgi close connection immediate on script finish – cris Oct 21 '10 at 22:21
  • @cris - Check the incoming traffic [traffic spike, resource not enough to handle]. Check lighttpd log on pages that spend long time to generate [when pages take longer time to response, it holding mysql resource]. Best bet to check where are the slow pages come from. – ajreal Nov 26 '10 at 05:55