Boost MySQL Performance by Tuning Thread Cache Size
This guide explains how the thread_cache_size setting in MySQL caches idle threads, how to monitor thread creation with Thread_created, and why increasing the cache size can reduce resource consumption and improve response times.
If the MySQL configuration file sets thread_cache_size, the thread that handled a client request is kept in a cache after the client disconnects, ready to serve the next client instead of being destroyed, provided the cache limit is not reached.
The status variable Thread_created shows the total number of threads that have been created. You can view it with: show global status like 'Thread%'; If Thread_created is unusually high, it indicates that MySQL is constantly creating new threads, which consumes resources. Increasing thread_cache_size can reduce this overhead.
You can check the current thread_cache_size setting with:
show variables like 'thread_cache_size';To change the cache size, execute for example:
set global thread_cache_size=32;Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Java High-Performance Architecture
Sharing Java development articles and resources, including SSM architecture and the Spring ecosystem (Spring Boot, Spring Cloud, MyBatis, Dubbo, Docker), Zookeeper, Redis, architecture design, microservices, message queues, Git, etc.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
