0

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?

1
  • Have you tried running SAME QUERY from laravel host using MYSQL CLIENT? Any change in performance ? Commented Jul 13, 2015 at 4:16

1 Answer 1

0

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.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.