php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #48051 mysql_connect slow
Submitted: 2009-04-22 15:39 UTC Modified: 2009-04-22 16:16 UTC
From: bouddhagod at hotmail dot com Assigned:
Status: Not a bug Package: Performance problem
PHP Version: 5.2.9 OS: Gentoo
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: bouddhagod at hotmail dot com
New email:
PHP Version: OS:

 

 [2009-04-22 15:39 UTC] bouddhagod at hotmail dot com
Description:
------------
I made a connection to a mysql server. The first time i load the page all look fine. It take about 3500 - 400 ms to do the jog. The second time I load the page ( it's a login screen ) the same mysql_connect take about 5-6 sec. Thoses 2 servers is located on the same computer ( dual xeon 2.4 with 1.5 gig of ram ). So I'm sure it's not a hardware problem.

Any suggestion ?

Reproduce code:
---------------
mysql_connect( "192.168.1.100", "username", "password");

Expected result:
----------------
not 5 SEC to responde...

Actual result:
--------------
first loading : 300 ms
second loading : 5 SEC
third loading : 300ms
fourth loading : 5 SEC
Etc ...

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-04-22 15:47 UTC] bouddhagod at hotmail dot com
function microtime_float()
{
    list($usec, $sec) = explode(" ", microtime());
    return ((float)$usec + (float)$sec);
}
$time_start = microtime_float();

$tutu = mysql_connect("192.168.1.100" , "user" , "password");

mysql_close($tutu);

$time_end = microtime_float();
$time = $time_end - $time_start;
    
echo "Did nothing in $time seconds\n";
 [2009-04-22 16:09 UTC] bouddhagod at hotmail dot com
If I put localhost all work fine.
 [2009-04-22 16:16 UTC] scottmac@php.net
This is probably firewall related or dns related. Nothing to do with PHP here.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 27 12:01:29 2024 UTC