|
Posted by Curt Zirzow on 11/09/83 11:36
On Tue, Jan 03, 2006 at 12:29:14PM -0500, James Tu wrote:
> I used phpMyAdmin to look at the stats for this mysql server.
>
> http://www.2-bit-toys.com/db_info/server_status.html
>
> What concerns me mainly are the stats at the top-right...'Failed
> attempts' and 'Aborted.'
> When would these situations occur? Is it normal to see these?
This is more of a mysql issue, a nice google of 'mysql connections
aborted' works pretty good [1].
> I'm using PHP's mysql_pconnect for all my scripts. Could this be
> causing the failed/aborted attempts? What is not clear is if
> mysql_pconnect will open another connection if the current one is
> being used.
Becareful with pconnect:
http://php.net/mysql_pconnect
http://php.net/manual/en/features.persistent-connections.php
Historically, both _connect and _pconnect will reuse an existing
connection based on the username, password and server it is
connecting to, within the same script so if you have
$dbh = mysql_pconnect('localhost', 'username', 'password');
$dbh2 = mysql_pconnect('localhost', 'username', 'password');
Both $dbh and $dbh2 are using the same resource. mysql_connect has
an option to remove this feature/flaw/annoyance.
As far as the 'Aborted' connections, and how php could affect the
value is with the _pconnect.... Consider you have a peak hour and
you have 100 requests (at one time), php now has reserved 100 connections to the db.
And after the peak, you just get about 10-50 requests. Those other
50-90 connections that php had made a connection to earlier become
stale (based on the mysql's wait_timeout or interactive_timeout
setting [1]) so an aborted connection is registered when a stale
connection is accessed.
[1] http://dev.mysql.com/communication-errors.html
HTH,
Curt.
--
cat .signature: No such file or directory
[Back to original message]
|