MySQL Forums :: PHP :: localhost vs. 127.0.0.1 connection (127.0.0.1 is slow!)
localhost vs. 127.0.0.1 connection (127.0.0.1 is slow!)
Date: April 11, 2007 01:49AM
I know that 127.0.0.1 goes through tcp/ip and localhost goes through the local socket so localhost will be faster. However, in our application, if I change the connection parameter to 127.0.0.1, the site becomes unusable (I'm talking about pages taking 2+ minutes or just never coming up). If I am on localhost, the pages usually come up within a matter of seconds.
Any ideas as to what is causing this? This is a big problem because we are starting to get a lot of traffic on our site so we want to move the mysql5 database out to it's own dedicated server but whenever we try that and change the connection parameters to the dedicated server's ip address (192.168.1.11), the site becomes unusable so we have to revert back to the single server setup again.
I am able to replicate this issue simply by using the local machine but changing "localhost" to "127.0.0.1" so I believe I have narrowed it down to a tcp/ip based configuration or issue.
When running mytop, it shows that we generally have anywhere from about 300-1500 qps (queries per secon) with most of the entries being around 600 or so qps.
We are on freebsd 6.1, mysql 5, php5, apache 2.2.
Any ideas? This has been driving me nuts because each time we try to deploy, we need to take the site down only to find that we have to revert back to the old code again.
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.