I am running a laravel application that is on a separate server than my MySQL database.

If I run the query on the Mysql server it takes the expected 0.00 - 0.01 seconds to return. However when I log the time from the start of a query to the end it takes .3secs. The whole API call takes between 800-1000ms.

I have changed my.cnf to skip-name-resolve, I have query cache turned on, I am using the IP and not the domain name for the connection.

I am not sure what else to try. This is a very simple RestAPI with simple queries and nothing complicated, and the largest table in the database has 9000 rows. I don't think it's a database issue, but a connection issue.

The CPU is only ever using 1%, and there is plenty of memory.

Any tricks I am missing?

  • Have you tried running SAME QUERY from laravel host using MYSQL CLIENT? Any change in performance ? – Nehal Dattani Jul 13 '15 at 4:16

I figured out that the slow performance was from my servers being in different regions / data centers.

After doing a traceroute it was taking average 40sec, and with 3ish queries per transaction that was adding up.

I create a new server in the same region and it is now much faster with a typical response being between 150-200ms.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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