3

I have a development environment set up with remote access to a shared dev database.

I'm experiencing VERY slow response time from the remote MySQL server. I've added skip-name-resolve to the my.cnf file, restarted mysqld, and also verified that it is indeed, turned on via 'show variables' at the mysql command line.

Interestingly, if I connect to the command line interface remotely via

mysql -h IPADDRESS -u USERNAME -p

All commands are executed lightning fast.

Select * on a large table comes down the pipe instantaneously.

I'm wondering why the CLI would allow immediate response, but the php connection in my application waits 8-10 seconds before returning any data from the remote MySQL server. It's an Amazon EC2 instance, and it's the Amazon linux ami, seems to be similar to CentOS. Any ideas?

Thanks!

RolandoMySQLDBA
  • 43,883
  • 16
  • 91
  • 132
Tyguy7
  • 573
  • 8
  • 15

2 Answers2

2

I've just solved same problem I was having, took me 4 days. Apache was ok MySQL was ok too Problem was in my script - gethostbyaddr(); when accessing web server on the localhost is fine. But when accessing the server from another computer takes ages, so for now I have commented out gethostbyaddr() and it is fast as if run from localhost. I am guessing gethostbyaddr() is some sort of Windows DNS issue which I'll look into later

Khurshid
  • 31
  • 2
1

I'd start by determining where the slowness comes from. Is it in establishing the connection when you open the db, or is it in returning the results from the select, or both? You don't say what version of PHP you're using or what version MySQL is running on the server. My money would be on that specific combination being problematic. Make sure you're running the latest updates on your AMI.

Mike Johnston
  • 348
  • 1
  • 9