The company relocated, freeing up a dell sc1420 Linux server. We are ready to move tomcat6 from window server2003 to RedHat as5, so we thought the speed would change qualitatively. After installation, it is found that the speed is much slower before, mainly because the connection between tomcat and mysql is too time-consuming. On the mysql website, reply as follows:
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 () cals, the thread uses them to perform hostname resolution.
If the operating system does not support the thread-safe cals, the thread locks a mutex and CILS 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 have 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.
Add the skip-networking option in mysqld of mysql. ini. The speed has indeed changed.