I use JDBC to connect to MySQL. When it’s at localhost:3306
, everything is OK.
But when I move my application to another computer in the intranet, and use <Intranet-IP>:3306
to connect to the MySQL database, it takes about 1 minute to connect to MySQL successfully. What’s up with this?
If your database is being used in high volumes, this can slow the database down. When there are too many queries to process at once, the CPU will bottleneck, resulting in a slow database.
normally means that there is no MySQL server running on the system or that you are using an incorrect Unix socket file name or TCP/IP port number when trying to connect to the server. You should also check that the TCP/IP port you are using has not been blocked by a firewall or port blocking service.
If you suspect that its a MySQL query, try inspecting the MySQL Slow Query Log. The log will help you identify queries that take long time to execute. You can then copy-paste the query text into a MySQL query session, execute it and observe the CPU usage.
Well it could be a DNS problem. You can disable DNS host name lookups by starting mysqld
with the --skip-name-resolve
option in the configuration file.
Read here for more details: http://dev.mysql.com/doc/refman/5.0/en/host-cache.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With