Forum Moderators: phranque
The machines are connected directly with a cross connect cable. We are seeing transfer speeds of 8mb/s with scp between the two of them. There is no indication that there is anything slow about the connection between the two of them.
I have one page where a string of 150 very simple queries are run one after another. It always loaded fairly fast (~0.1 second load time) in the past on our old servers (same setup - one web and one database). Now the page is taking about 2 seconds to load.
I used the Advanced PHP Debugger (APD) profiler to see what functions were taking the most time because we thought it might be something wrong with PHP. The mysql_connect and mysql_select_db were taking the most time, but why so much?
Next I decided to time the queries from the command line on both the web server (where the page is loading slow) and locally on the database server:
---
-bash-2.05b$ time mysql -h localhost -u [removed] -p[removed] -D [removed] < queries
[query results removed]
real 0m0.026s
user 0m0.000s
sys 0m0.015s
su-2.05b# time mysql -h db0 -u [removed] -p[removed] -D [removed] < queries
[query results removed]
real 0m1.153s
user 0m0.000s
sys 0m0.020s
---
You can see the huge time difference. If I swap out the db0 alias for 192.168.0.1 the local address of the database server, it takes the same amount of time.
Does anyone have any clue as to why this might be happening?
Any help would be VERY much appreciated.
Thanks!
su-2.05b# ping db0
PING db0 (192.168.0.1): 56 data bytes
64 bytes from 192.168.0.1: icmp_seq=0 ttl=64 time=0.097 ms
64 bytes from 192.168.0.1: icmp_seq=1 ttl=64 time=0.092 ms
64 bytes from 192.168.0.1: icmp_seq=2 ttl=64 time=0.117 ms
64 bytes from 192.168.0.1: icmp_seq=3 ttl=64 time=0.111 ms
64 bytes from 192.168.0.1: icmp_seq=4 ttl=64 time=0.102 ms
64 bytes from 192.168.0.1: icmp_seq=5 ttl=64 time=0.090 ms
64 bytes from 192.168.0.1: icmp_seq=6 ttl=64 time=0.102 ms
64 bytes from 192.168.0.1: icmp_seq=7 ttl=64 time=0.105 ms
^C
--- db0 ping statistics ---
8 packets transmitted, 8 packets received, 0% packet loss
round-trip min/avg/max/stddev = 0.090/0.102/0.117/0.009 ms