Slow connection to the database after tomcat is started

Source: Internet
Author: User
Tags mysql connection pool

After starting the tomcat service and entering the Project address, we can find that the page remains in the loading process for several minutes, which cannot be allowed in a normal production environment. Therefore, a corresponding investigation was conducted. The problem may be caused by the number of connections in the mysql connection pool of the project, but the problem persists after the change.
Check whether the connection status of the current mysql instance is correct. Use the mysqladmin-uroot-p processlist command to find the unauthenticated user.
| 327 | unauthenticated user | 192.168.110.39: 50955 | Connect | login |
After checking on the Internet, it is determined that it is a problem of reverse resolution of Mysql DNS. Mysql will try to resolve the IP address to the DNS domain name no matter whether the database is connected through direct IP or domain name connection, currently, applications are directly connected to the database through IP addresses, and Mysql still takes a long time to try to resolve the IP address as a DNS domain name.
Therefore, modify the my. cnf configuration file.
1. Stop mysql
2. modify my. cnf and add skip-name-resolve
3. Start mysql
Restart tomcat to access the Project address-the speed is flying!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.