diff options
Diffstat (limited to 'sql')
-rw-r--r-- | sql/sys_vars.cc | 11 | ||||
-rw-r--r-- | sql/threadpool.h | 1 | ||||
-rw-r--r-- | sql/threadpool_common.cc | 1 | ||||
-rw-r--r-- | sql/threadpool_unix.cc | 4 |
4 files changed, 13 insertions, 4 deletions
diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index 6feba50a00d..a6485dcaef8 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -2215,7 +2215,8 @@ static bool fix_threadpool_size(sys_var*, THD*, enum_var_type) static bool fix_threadpool_stall_limit(sys_var*, THD*, enum_var_type) { - tp_set_threadpool_stall_limit(threadpool_size); + tp_set_threadpool_stall_limit(threadpool_stall_limit); + return false; } #endif @@ -2236,6 +2237,12 @@ static Sys_var_uint Sys_threadpool_idle_thread_timeout( GLOBAL_VAR(threadpool_idle_timeout), CMD_LINE(REQUIRED_ARG), VALID_RANGE(1, UINT_MAX), DEFAULT(60), BLOCK_SIZE(1) ); +static Sys_var_uint Sys_threadpool_oversubscribe( + "thread_pool_oversubscribe", + "How many additional active worker threads in a group are allowed.", + GLOBAL_VAR(threadpool_oversubscribe), CMD_LINE(REQUIRED_ARG), + VALID_RANGE(1, 1000), DEFAULT(3), BLOCK_SIZE(1) +); static Sys_var_uint Sys_threadpool_size( "thread_pool_size", "Number of concurrently executing threads in the pool. " @@ -2252,7 +2259,7 @@ static Sys_var_uint Sys_threadpool_stall_limit( "If a worker thread is stalled, additional worker thread " "may be created to handle remaining clients.", GLOBAL_VAR(threadpool_stall_limit), CMD_LINE(REQUIRED_ARG), - VALID_RANGE(60, UINT_MAX), DEFAULT(500), BLOCK_SIZE(1), + VALID_RANGE(10, UINT_MAX), DEFAULT(500), BLOCK_SIZE(1), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0), ON_UPDATE(fix_threadpool_stall_limit) ); diff --git a/sql/threadpool.h b/sql/threadpool.h index a8e7f9031b3..966dcbc18e0 100644 --- a/sql/threadpool.h +++ b/sql/threadpool.h @@ -7,6 +7,7 @@ extern uint threadpool_idle_timeout; /* Shutdown idle worker threads after this extern uint threadpool_size; /* Number of parallel executing threads */ extern uint threadpool_stall_limit; /* time interval in 10 ms units for stall checks*/ extern uint threadpool_max_threads; /* Maximum threads in pool */ +extern uint threadpool_oversubscribe; /* Maximum active threads in group */ /* Threadpool statistics diff --git a/sql/threadpool_common.cc b/sql/threadpool_common.cc index b6676576fb3..91ae41a058f 100644 --- a/sql/threadpool_common.cc +++ b/sql/threadpool_common.cc @@ -23,6 +23,7 @@ uint threadpool_idle_timeout; uint threadpool_size; uint threadpool_stall_limit; uint threadpool_max_threads; +uint threadpool_oversubscribe; /* diff --git a/sql/threadpool_unix.cc b/sql/threadpool_unix.cc index d9eb90532af..ec9f5a91d40 100644 --- a/sql/threadpool_unix.cc +++ b/sql/threadpool_unix.cc @@ -839,13 +839,13 @@ static void post_event(thread_group_t *thread_group, pool_event_t* ev) /* - Check if pool is already overcommited. This is used to prevent too many threads executing at the same time, if the workload is not CPU bound. */ static bool too_many_threads(thread_group_t *thread_group) { - return (thread_group->active_thread_count >= 4 && !thread_group->stalled); + return (thread_group->active_thread_count >= 1+(int)threadpool_oversubscribe + && !thread_group->stalled); } |