Advantages of using Threadpool
The thread proxy model can be used to create a thread in advance and maintain it using the threadpool technology of the operating system when the number of connections is known to be controllable. This reduces a lot of overhead.
Use the thread management of the operating system as much as possible to minimize the thread management overhead. 3. Use thread_pool_max_threads to control the resource usage. Under what circumstances does the Thread Pool play a relatively small role:
High concurrency and long statement operations. For example, the total number of internal threadpools is 10, and 1000 requests are concurrently sent outside. Currently, all these 10 Internal Threads are competing for use, which is also a heavy overhead. Similarly, when threadpool is increased, innodb's internal concurrency will also be limited.
A large number of sudden connections. In this case, threadpool has a certain effect, but the effect is not obvious. To prevent a large number of connections. You can increase the value of thread_pool_min_threads and thread_pool_idle_timeout to maintain a large threadpool high concurrency environment, which may slow down simple queries. Although select 1; such a query should be completed very quickly. However, under the threadpool, you also need to queue up and wait for the thread available from theadpool to be executed.
Usage:
Currently, threadpool is supported by MariaDB, Percona, and a charging function of MySQL. Enable configuration.
In my. cnf
- [mysqld]
- #thread pool
- thread_handling=pool-of-threads
- thread_pool_max_threads=300
- thread_pool_size=64
Link: http://www.mysqlsupport.cn/%EF%BD%8Dariadb-thread-pool/