MySQL optimization--skip-name-resolve

Source: Internet
Author: User
Tags ip number mutex

The same IDC, IDC internal DNS server, the IP of each server to do a reverse resolution,
but not the internal IP to do the reverse resolution, so use Skip-name-resolve after using the intranet address to Mysqlslap request response half faster


Appendix: 7.5.6. How MySQL uses DNS

involves parameter--skip-name-resolve,--skip-host-cache,--skip-networking

When a new client connects Mysqld. Mysqld creates a new thread to process the request. The thread first checks whether the hostname is in the host name cache. If not, the thread attempts to resolve the hostname:

         If the operating system supports thread safety Gethostbyaddr_r () and Gethostbyname_r () calls, which threads use to perform host name resolution.

         If the operating system does not support thread-safe calls, the thread locks a mutex and calls Gethostbyaddr () and gethostbyname (). In this case, no other thread can resolve the host name that is not in the host name cache until the 1th line threads unlocked the mutex.

You can use the--skip-name-resolve option to start mysqld to disable DNS host name lookups. However, in this case, you can only use the IP number in the authorization table in MySQL.

If you have a slow DNS and many hosts, you can improve performance by disabling DNS lookups with--skip-name-resolve or by increasing the Host_cache_size definition (default: 128) and recompiling the mysqld.

You can use the--skip-host-cache option to start the server to disable host name caching. To clear the host name cache, execute the FLUSH hosts statement or execute the mysqladmin flush-hosts command.

If you want to disable TCP/IP connections completely, start mysqld with the--skip-networking option.

When you connect to MySQL, it will make a reverse address query to DNS
only after the time-out fails, MySQL will respond to the client
waiting to resolve the MySQL process is the login status

MySQL optimization--skip-name-resolve

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.