MySQL thread cache thread_cache_size Parameter Optimization

Source: Internet
Author: User
Thread_cahe_size thread pool, thread cache. It is used to cache Idle threads so that they are not destroyed. If the Idle threads in the thread cache need to re-establish a new connection

Thread_cahe_size thread pool, thread cache. It is used to cache Idle threads so that they are not destroyed. If the Idle threads in the thread cache need to re-establish a new connection

Thread_cahe_size thread pool, thread cache. It is used to cache Idle threads so that they are not destroyed. If the Idle threads in the thread cache need to re-establish a new connection, the cache in the thread pool will be called first and the connection request will be quickly responded.

Each time a connection is established, a thread must match it.

MariaDB [(none)]> show global status like '% thread % ';

+ ------------------------------------------ + ---------- +

| Variable_name | Value |

+ ------------------------------------------ + ---------- +

| Delayed_insert_threads | 0 |

| Innodb_master_thread_1_second_loops | 4338823 |

| Innodb_master_thread_10_second_loops | 432031 |

| Innodb_master_thread_background_loops | 18974 |

| Innodb_master_thread_main_flush_loops | 18974 |

| Innodb_master_thread_sleeps | 4338819 |

| Performance_schema_thread_classes_lost | 0 |

| Performance_schema_thread_instances_lost | 0 |

| Slow_launch_threads | 0 |

| Threadpool_idle_threads | 0 |

| Threadpool_threads | 0 |

| Threads_cached | 0 | indicates the idle thread in the thread cache at this moment.

| Threads_connected | 11 | Number of established connections

| Threads_created | 11032160 | Number of threads created since the last time the service was started

| Threads_running | 2 | Number of currently activated (non-sleep) threads

+ ------------------------------------------ + ---------- +

Thread_cache_size should be set to the same as threads_connected. However, the size of thread_cache_size is much larger than 200.

Configuration:

Mysql> set global thread_cache_size = 30 takes effect immediately

Or

Vim/etc/my. cnf

Thread_concurrency = 30

Restart mysql.

This article permanently updates the link address:

Related Article

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.