Linuxtomcat连接WindowMySQL异常的解决
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了Linuxtomcat连接WindowMySQL异常的解决,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含1829字,纯文字阅读大概需要3分钟。
内容图文
![Linuxtomcat连接WindowMySQL异常的解决](/upload/InfoBanner/zyjiaocheng/554/ae6c8ff5f975474590e10c2419a7c87f.jpg)
公司搬迁,腾出了一台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。速度果然有飞得改变。
内容总结
以上是互联网集市为您收集整理的Linuxtomcat连接WindowMySQL异常的解决全部内容,希望文章能够帮你解决Linuxtomcat连接WindowMySQL异常的解决所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。