Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have 2 servers, both running Ubuntu server 11.10. The first server runs Apache and PHP and it connects to a Mysql database on the second server.

The problem is slow mysql response on the second server.mysql logs does not show any errros other than: 120526 12:56:27 [Note] Plugin 'FEDERATED' is disabled. but that does not prevent mysql from starting/restarting.

I tried to run queries from inside the mysql server using the same php app on the first server and it was very fast. but when the same php app requests data from the first server to the mysql server the response is really slow and the database is not big.

How can i find whats causing the problem ?

Note: am using IP address when connecting via php app from server 1 to server 2, so i dont think this is DNS related.


share|improve this question
I think you would need to post an example of the type of query, the size and configuration of the table (rows, engine type, create statement), and some more details of the 2 servers in terms of RAM, networking etc. – Tom H May 26 '12 at 11:14
re @Khaled point, mysql will try to reverse lookup the IP address, so you have to disable dns with skip-name-resolve **even if ** you are only using ip address for addresses. – Tom H May 26 '12 at 11:16
up vote 1 down vote accepted

There can be many factors that affect mysql performance:

  1. Make sure you are comparing the same queries locally vs. remotely.
  2. Check the network bandwidth/delay between the two servers.
  3. Try starting mysql server with --skip-name-resolve option. This disables DNS resolution which may cause unneeded delays.
share|improve this answer
I added --skip-name-resolve in /etc/mysql/my.cnf but that did not seem to resolve the issue. And the mtr report from server 1 to server 2 seems very fine, fast reply and no data loss – zertux May 26 '12 at 11:07
What about other points like network bandwidth? – Khaled May 26 '12 at 11:09
network bandwidth is not limited. – zertux May 26 '12 at 11:11
It seems that --skip-name-resolve solved the problem for now, Am still testing the network side to get more information. Thanks alot for the help :) – zertux May 26 '12 at 12:06

first of all you had to find out where the problem is located. on the network or on the server. you can test the network performance between the server with iperf On Ubuntu you can use apt-get to install iperf.

the problem can be dns related even when you use ip addresses to connect. most server try to do a reverse lookup when a client connects. when the client isn't resolvable the server will wait for a timeout and after that go on with the request.

share|improve this answer
Am in the process of testing the network now, will post the results soon, thanks for the help. – zertux May 26 '12 at 11:24

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.