php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #54212 Localhost resolves much more slowly than 127.0.0.1 on mysql_connect()
Submitted: 2011-03-10 10:45 UTC Modified: 2013-02-18 00:34 UTC
Votes:2
Avg. Score:3.5 ± 1.5
Reproduced:2 of 2 (100.0%)
Same Version:2 (100.0%)
Same OS:2 (100.0%)
From: kriscraig@php.net Assigned:
Status: No Feedback Package: MySQL related
PHP Version: 5.3.5 OS: Windows
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
23 - 5 = ?
Subscribe to this entry?

 
 [2011-03-10 10:45 UTC] kriscraig@php.net
Description:
------------
I'm told that a number of people have been reporting this issue.  The reports I'm hearing state that people are finding it to be about 3-4 times slower when done by hostname.

My guess would be this is another IPv6-related issue.  It's also worth noting that I have not yet been able to independently verify these numbers, though I am working on doing so and will post the data if/when I have it.

It was requested that I post this bug so that we have a record of it.  If you've experienced any hostname vs. IP performance issues (good or bad), please post a comment here so we have the reports in one central place.  Thanks!

Test script:
---------------
<?php

if ( !isset( $_GET["host"] ) )
{
	die( "You must specify ?host= in the URL string.  Example:  mysql_connect_test.php?host=localhost" );
}

$start = microtime( TRUE );

$link = mysql_connect( $_GET["host"], "root", "(your-password-here)" ) or die( "Function mysql_connect() failed." );

$end = microtime( TRUE );
$duration = $end - $start;
print "<b>Execution Time:</b>&nbsp; $duration sec<br />\r\n";



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-03-10 10:53 UTC] uw@php.net
If there is anything, its not MySQL specific. mysqlnd is using PHP Streams. PHP Streams should be the source. Only other cause I can think of is MySQL server.
 [2011-03-10 10:53 UTC] pajoye@php.net
-Status: Open +Status: Feedback
 [2011-03-10 10:53 UTC] pajoye@php.net
We need:

- windows version
- Whether IPv6 is enabled or not

Please try using simple socket as well, or using 
fopen('http://localhost/foo.php'); while being sure that localhost is actually 
IPv6 or Ipv4, to compare both. That will let us diagnose the issue without 
having to rely on mysql.
 [2011-03-10 11:06 UTC] kriscraig@php.net
I'm sorry guys, I realize this report is very scant on details.  Please keep in mind I'm reporting it on someone else's behalf at their request.  I posted all the details I've been given and have requested further information, which I will post here as soon as I get it.

I possibly should've waited, but I'd already promised to have it posted by EOD today.
 [2011-06-03 19:39 UTC] pajoye@php.net
Please try using this snapshot:

  http://snaps.php.net/php5.3-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/


 [2011-06-03 21:05 UTC] kriscraig@php.net
I'd be happy to take a look over the weekend.  I'll run the test script and post the results when I get a spare moment.
 [2013-02-18 00:34 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 09:01:27 2024 UTC