Back to Home

MySQL tuning - thread_cache_size

mysql · tuning · optimization · performance optimization · performance

MySQL tuning - thread_cache_size

    The thread_cache_size parameter plays an important role in the performance of a loaded MySQL server. In some cases, you can increase productivity by 30-50%.

    This parameter indicates the number of threads going to the cache when the client is disconnected. With a new connection, the thread is used from the cache, which saves resources at high loads.


    You can identify the need to optimize the thread_cache_size parameter in the following way:
    mysqladmin -u root -p extended-status | grep Threads
    


    If the value of Threads_created is significantly greater than Threads_cached (by thousands), then thread_cache_size is either too small or completely disabled.

    The optimal value of thread_cache_size, at which Threads_created is kept at an acceptable level, ranges from 8 to 100, depending on the load and amount of memory.

    It is recommended that you gradually increase the value of thread_cache_size and observe Threads_created until Threads_created is slightly larger than Threads_cached.

    Read Next