MySQL optimization parameter thread_cache_size

Source: Internet
Author: User

thread_cache_size function in the MySQL database configuration file is a very important feature, if the Thread_cache_size optimization is done well we can let the server run very fast, the settings are not good will find a very small amount of access to the card Oh. The thread_cache_size query process usage code follows the copy code MySQL> ShowGlobalStatus like ' thread%';+ ——————-+ ———-+| variable_name | Value |+ ——————-+ ———-+| threads_cached | -|| threads_connected |510|| threads_created |35168165|| threads_running |459|+ ——————-+ ———-+4Rowsinch Set(0.01sec) query Server Thread_cache_size configuration code as follows copy code MySQL>Show variables like ' thread_cache_size ';+ ——————-+ ——-+| variable_name | Value |+ ——————-+ ——-+| Thread_cache_size | +|+ ——————-+ ——-+1Rowinch Set(0.00sec) If we set the thread_cache_size in the MySQL server configuration file, when the client disconnects, the server processes the client's thread to cache in response to the next customer instead of destroying it (provided the cache count is not up to the limit). Threads_created indicates the number of threads created, if the threads_created value is found to be too large, it indicates that the MySQL server has been creating threads, which is also a relatively resource-intensive, can appropriately increase the thread_cache_size value in the configuration file, According to the survey found that the server thread cache Thread_cache_size is not set, or too small, this value indicates that the number of threads saved in the cache can be re-used, and if there is room in the cache when disconnected, then the client's thread will be placed in the cache if the thread is re-requested , the request will be read from the cache, and if the cache is empty or a new request, then the thread will be recreated, and if there are many new threads, increasing this value can improve system performance. By comparing the variables of the Connections and threads_created states, You can see the effect of this variable. (?>represents the value to adjust) according to the physical memory setting rules are as follows: 1G?>82G?> -3G?> +>3G?> -

MySQL optimization parameter thread_cache_size

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.