The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

PHP: Remote MySQL connections very slow

Discussion in 'Database Discussions' started by Reado, Nov 22, 2011.

  1. Reado

    Reado Well-Known Member

    Joined:
    Sep 8, 2009
    Messages:
    161
    Likes Received:
    4
    Trophy Points:
    18
    Location:
    United Kingdom
    cPanel Access Level:
    DataCenter Provider
    I have two servers, both running CentOS 5.7 and cPanel-CURRENT. One is x86 and the other is x64. Both are using Apache 2.2.21, PHP 5.3.8 and MySQL 5.1.

    If I query the local database on any one of the servers, the results are returned instantly. In this instance a few thousand results are being returned. However running the same query from one server to another and the query takes 10+ seconds to complete.

    If I use MySQL Workbench 5.2 to query the remote database from my workstation with the same query, it completes in less than a second, which makes me think there's a problem with PHP or something else server-related.

    Has anyone else encountered this issue before and know how to resolve it? Any help would be greatly appreciated.
     
  2. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    64-bit machines can query and return better results due to being able to use more memory than 32-bit machines. As such, it's possible the 32-bit machine itself simply isn't going to return queries as quickly. I did testing on both arch types for MySQL and all tests indicated that 64-bit machines are the way to go with MySQL for faster responses as well as lower load with that service.

    Also, what is the example query?

    Next, is there any way you can switch the 32-bit machine to a 64-bit machine in the future by a migration so both are running on 64-bit platforms?
     
  3. Reado

    Reado Well-Known Member

    Joined:
    Sep 8, 2009
    Messages:
    161
    Likes Received:
    4
    Trophy Points:
    18
    Location:
    United Kingdom
    cPanel Access Level:
    DataCenter Provider
    Thanks for your reply. I can query the remote server from my workstation (Windows 7 Ultimate x64) and return 1000 results in less than a second. However on the local server, running the same query to the remote server takes 10 seconds or more.

    Both the local server and my workstation are connecting over the same VDSL2+ connection to the remote server and both local machines are connected to the same local Gigabit Switch.

    Could this point to a problem with the local server rather than the configuration of the remote server?
     
Loading...

Share This Page