MySQL remote connection is slower even after enabling pass name resolution
I have a development environment set up with remote access to a shared dev database.
I am experiencing VERY slow response times from a remote MySQL server. I added skip-name-resolve to my.cnf file, restarted mysqld, and also verified that it is indeed enabled using 'show variables' on the mysql command line.
I wonder if I connect to the command line interface remotely via
mysql -h IPADDRESS -u USERNAME -p
All commands are executed with lightning speed.
A selection * on a large table instantly descends the pipe.
I'm wondering why the CLI will allow an immediate response, but the php connection in my application waits 8-10 seconds before returning any data from the remote MySQL server. This is an Amazon EC2 instance and the Amazon linux ami seems to be similar to CentOS. Any ideas?
Thank!
source to share
I just solved the same problem as mine, took me 4 days. Apache was ok MySQL was ok too The problem was in my script - gethostbyaddr (); when accessing the webserver on localhost is fine. But when accessing the server from another computer it takes age, so at the moment I commented out gethostbyaddr () and it is fast as if it is running from localhost. I'm guessing gethostbyaddr () is some kind of Windows DNS issue, which I'll talk about later.
source to share
I would start by identifying where slowness starts. Is this establishing a connection when opening the db, or is it when returning results from the selected or both? You don't say which version of PHP you are using or which version of MySQL you are running on the server. My money would be on that particular combination that would be problematic. Make sure you are using the latest updates in your AMI.
source to share