Linux tomcat连接Window MySQL异常的解决
公司搬迁,腾出了一台dell sc1420 Linux 服务器。就准备把tomcat6从window server2003移到redhat as5下,本以为速度会有质的改变
公司搬迁,腾出了一台dell sc1420 Linux 服务器。就准备把tomcat6从window server2003移到RedHat as5下,本以为速度会有质的改变。可安装上去后,发现速度以前更慢了很多,,主要是tomcat 与mysql connection的太费时。在mysql的网站这样答复:
6.5.9. How MySQL Uses DNS
When a new client connects to mysqld, mysqld spawns a new thread to handle the request. This thread first checks whether the hostname is in the hostname cache. If not, the thread attempts to resolve the hostname:
If the operating system supports the thread-safe gethostbyaddr_r() and gethostbyname_r() calls, the thread uses them to perform hostname resolution.
If the operating system does not support the thread-safe calls, the thread locks a mutex and calls gethostbyaddr() and gethostbyname() instead. In this case, no other thread can resolve hostnames that are not in the hostname cache until the first thread unlocks the mutex.
You can disable DNS hostname lookups by starting mysqld with the --skip-name-resolve option. However, in this case, you can use only IP numbers in the MySQL grant tables.
If you have a very slow DNS and many hosts, you can get more performance by either disabling DNS lookups with --skip-name-resolve or by increasing the HOST_CACHE_SIZE define (default value: 128) and recompiling mysqld.
You can disable the hostname cache by starting the server with the --skip-host-cache option. To clear the hostname cache, issue a FLUSH HOSTS statement or execute the mysqladmin flush-hosts command.
To disallow TCP/IP connections entirely, start mysqld with the --skip-networking option.
在mysql.ini的mysqld添加skip-networking option。速度果然有飞得改变。
上一篇: 简单php生成 execel表格 程序
推荐阅读
-
Linux连接mysql报错:Access denied for user ‘root’@‘localhost’(using password: YES)的解决
-
Linux连接mysql报错:Access denied for user ‘root’@‘localhost’(using password: YES)的解决
-
记录Window系统下myeclipes连接linux下mysql所出现的一个bug
-
解决在Linux操作系统下无法连接MySQL服务端的问题
-
Linux连接mysql报错:Access denied for user ‘root’@‘localhost’(using password: YES)的解决方法
-
navicat连接不上linux服务器上的mysql的解决办法
-
linux配置mysql数据库远程连接失败的解决方法
-
对于使用JDBC连接mysql数据时The server time zone value '¤¤°ê¼Ð·Ç®É¶¡'...的异常问题解决。
-
Linux环境下连接SUN MQ 出现 connection refused异常的解决方案
-
Linux连接mysql报错:Access denied for user ‘root’@‘localhost’(using password: YES)的解决方法