[HyperDB] tcp_responsiveness - what's it all about?

Liz Wendland liz at duke.edu
Mon Jan 24 17:05:07 UTC 2011


We have a WordPress installation using a semi-complicated MySQL database 
setup facilitated by HyperDB.  It mostly works great, but we have 
periodic failures where one of the databases starts to refuse 
connections from one of the web front-ends.  It was in the pursuit of 
debugging this issue that we noticed we were collecting a huge number of 
'aborted connections' in our databases.

We have tracked this down to the 'check_tcp_responsiveness' function in 
db.php.  Apparently this function will open a socket connection to the 
database at the mysql port and as soon as it responds, it disconnects.  
MySQL doesn't really like this teasing approach to ping and counts that 
as an aborted connection.

We aren't sure if the number of aborted connections is causing our 
problem, but it seems like a strange way to check database 
responsiveness.  I am hoping someone can help shed some light on the 

1) Is the tcp_responsiveness code left over debug?  The variable names 
in db-config.php and db.php do not match:
db-config.php has

$wpdb->tcp_responsiveness_check = true;

db.php has

var $check_tcp_responsiveness = true;

2) There is a clause in db.php (function check_tcp_responsiveness) that 
seems like it will always evaluate to false...
     if ( 1 == 2 && function_exists('apc_store') ) {

3) The code says something about this function being necessary because 
"This was added because PHP's mysql functions do not provide a variable 
timeout setting"  Couldn't the mysql.connect_timeout value in php.ini 
provide this?

We currently have fixed db-config.php so it has:
$wpdb->check_tcp_responsiveness = false;

and we are no longer seeing the aborted connections increasing.  Only 
time will tell if this fixes the random database lockouts.

Thanks for any additional information,

More information about the HyperDB mailing list