PHP: Remote MySQL connections very slow

Reado

Well-Known Member
Sep 8, 2009
251
14
68
United Kingdom
cPanel Access Level
Root Administrator
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.
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
43
348
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?
 

Reado

Well-Known Member
Sep 8, 2009
251
14
68
United Kingdom
cPanel Access Level
Root Administrator
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?