Spec-Zone .ru
спецификации, руководства, описания, API
|
The thread pool feature comprises these components:
A plugin library object file contains a plugin for the thread pool code and plugins
for several INFORMATION_SCHEMA
tables.
For a detailed description of how the thread pool works, see Section 8.11.6.2, "Thread Pool Operation".
The INFORMATION_SCHEMA
tables are named TP_THREAD_STATE
, TP_THREAD_GROUP_STATE
, and TP_THREAD_GROUP_STATS
. These tables provide information about thread
pool operation. For more information, see Section
20.31, "Thread Pool INFORMATION_SCHEMA
Tables".
Several system variables are related to the thread pool. The thread_handling
system variable has a value of loaded-dynamically
when the server successfully loads the thread pool plugin.
The other related variables are implemented by the thread pool plugin; they are not available unless it is enabled:
thread_pool_algorithm
: The concurrency algorithm to use for
scheduling.
thread_pool_high_priority_connection
: How to schedule
statement execution for a session.
thread_pool_prio_kickup_timer
: How long before the thread
pool moves a statement awaiting execution from the low-priority queue to the high-priority
queue.
thread_pool_max_unused_threads
: How many sleeping threads to
permit.
thread_pool_size
: The number of thread groups in the thread
pool. This is the most important parameter controlling thread pool performance.
thread_pool_stall_limit
: The time before an executing
statement is considered to be stalled.
If any variable implemented by the plugin is set to an illegal value at startup, plugin initialization fails and the plugin does not load.
For information about setting thread pool parameters, see Section 8.11.6.3, "Thread Pool Tuning".
The Performance Schema exposes information about the thread pool and may be used to investigate operational performance. For more information, see Chapter 21, MySQL Performance Schema.
To be usable by the server, the thread pool library object file must be located in the MySQL plugin directory
(the directory named by the plugin_dir
system variable). To enable thread pool capability, load the
plugins to be used by starting the server with the --plugin-load
option. For example, if you name just the plugin object file,
the server loads all plugins that it contains (that is, the thread pool plugin and all the INFORMATION_SCHEMA
tables). To do this, put these lines in your my.cnf
file:
[mysqld]plugin-load=thread_pool.so
If object files have a suffix different from .so
on your system, substitute the
correct suffix (for example, .dll
on Windows).
If necessary, set the value of the plugin_dir
system variable to tell the server the location of the plugin
directory.
If desired, you can load individual plugins from the library file. To load the thread pool plugin but not the
INFORMATION_SCHEMA
tables, use an option like this:
[mysqld]plugin-load=thread_pool=thread_pool.so
To load the thread pool plugin and only the TP_THREAD_STATE
INFORMATION_SCHEMA
table, use an
option like this:
[mysqld]plugin-load=thread_pool=thread_pool.so;TP_THREAD_STATE=thread_pool.so
To verify plugin installation, examine the INFORMATION_SCHEMA.PLUGINS
table or use the SHOW PLUGINS
statement. See Section
5.1.8.2, "Obtaining Server Plugin Information".
If the server loads the thread plugin successfully, it sets the thread_handling
system variable to dynamically-loaded
. If the plugin fails to load, the server
writes a message to the error log.