Req #60716 [Opn]: Ability to set PDO connection timeout in milliseconds

From: Date: Wed, 02 May 2012 07:32:48 +0000
Subject: Req #60716 [Opn]: Ability to set PDO connection timeout in milliseconds
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-170073@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=60716&edit=1

 ID:                 60716
 Updated by:         uw@php.net
 Reported by:        markrose at markrose dot ca
 Summary:            Ability to set PDO connection timeout in
                     milliseconds
 Status:             Open
 Type:               Feature/Change Request
 Package:            PDO related
 Operating System:   n/a
 PHP Version:        5.4.0RC5
 Block user comment: N
 Private report:     N

 New Comment:

For the MySQL part this can be considered Bogus/Not a bug because PHP is the wrong place to ask for
it. Please, file a bug at MySQL.

The underlying MySQL C API does not offer sub second granularity for setting the connect timeout. If
it was to be fixed, it should be done at the lowest level which is the MySQL C API. No matter
whether we are talking mysqlnd or MySQL Client Library (libmysql). See also http://dev.mysql.com/doc/refman/5.6/en/mysql-options.html
and http://blog.ulf-wendel.de/?p=273

For the PDO part, I am not too keen of driver specific settings. What's the purpose of PDO if
not providing an abstraction for it... However, for years now PDO seems kind of neglected, nobody
feeling too much responsible for it.


Previous Comments:
------------------------------------------------------------------------
[2012-01-11 17:20:38] markrose at markrose dot ca

Description:
------------
I'd like the ability to set PDO's connection timeout (to MySQL specifically) in 
milliseconds. The lowest the timeout can current be set to is 1 second, which is 
an extremely long time to wait for a database machine to reply.

I run a synchronously replicated MySQL environment (Galera), and I'd like to be 
able to move on to the next machine if the database doesn't respond in say, 10 
ms. Instead, PHP waits one second. This reduces the throughput of my PHP scripts 
from several hundred per second to only a handful per second, severely impacting 
performance and quickly exhausting the PHP thread pool, leading to timeouts.



------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=60716&edit=1


Thread (3 messages)

« previous php.bugs (#170073) next »