mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Small adjustements to threadpool
This commit is contained in:
@ -1159,6 +1159,8 @@ void my_net_set_read_timeout(NET *net, uint timeout)
|
||||
{
|
||||
DBUG_ENTER("my_net_set_read_timeout");
|
||||
DBUG_PRINT("enter", ("timeout: %d", timeout));
|
||||
if(net->read_timeout == timeout)
|
||||
DBUG_VOID_RETURN;
|
||||
net->read_timeout= timeout;
|
||||
#ifdef NO_ALARM
|
||||
if (net->vio)
|
||||
@ -1172,6 +1174,8 @@ void my_net_set_write_timeout(NET *net, uint timeout)
|
||||
{
|
||||
DBUG_ENTER("my_net_set_write_timeout");
|
||||
DBUG_PRINT("enter", ("timeout: %d", timeout));
|
||||
if(net->write_timeout == timeout)
|
||||
DBUG_VOID_RETURN;
|
||||
net->write_timeout= timeout;
|
||||
#ifdef NO_ALARM
|
||||
if (net->vio)
|
||||
|
@ -749,6 +749,7 @@ THD::THD()
|
||||
derived_tables_processing(FALSE),
|
||||
spcont(NULL),
|
||||
m_parser_state(NULL),
|
||||
skip_wait_timeout(false),
|
||||
#if defined(ENABLED_DEBUG_SYNC)
|
||||
debug_sync_control(0),
|
||||
#endif /* defined(ENABLED_DEBUG_SYNC) */
|
||||
|
@ -1697,6 +1697,9 @@ public:
|
||||
/* True if we want to log all errors */
|
||||
bool log_all_errors;
|
||||
|
||||
/* Do not set socket timeouts for wait_timeout (used with threadpool) */
|
||||
bool skip_wait_timeout;
|
||||
|
||||
/* container for handler's private per-connection data */
|
||||
Ha_data ha_data[MAX_HA];
|
||||
|
||||
|
@ -701,7 +701,7 @@ bool do_command(THD *thd)
|
||||
the client, the connection is closed or "net_wait_timeout"
|
||||
number of seconds has passed.
|
||||
*/
|
||||
if(!skip_net_wait_timeout)
|
||||
if(!thd->skip_wait_timeout)
|
||||
my_net_set_read_timeout(net, thd->variables.net_wait_timeout);
|
||||
|
||||
|
||||
|
@ -2220,7 +2220,7 @@ static Sys_var_uint Sys_threadpool_size(
|
||||
"Number of concurrently executing threads in the pool. "
|
||||
"Leaving value default (0) sets it to the number of processors.",
|
||||
GLOBAL_VAR(threadpool_size), CMD_LINE(REQUIRED_ARG),
|
||||
VALID_RANGE(0, 128), DEFAULT(0), BLOCK_SIZE(1)
|
||||
VALID_RANGE(1, 128), DEFAULT(my_getncpus()), BLOCK_SIZE(1)
|
||||
);
|
||||
static Sys_var_uint Sys_threadpool_stall_limit(
|
||||
"thread_pool_stall_limit",
|
||||
@ -2231,12 +2231,12 @@ static Sys_var_uint Sys_threadpool_stall_limit(
|
||||
GLOBAL_VAR(threadpool_stall_limit), CMD_LINE(REQUIRED_ARG),
|
||||
VALID_RANGE(60, UINT_MAX), DEFAULT(500), BLOCK_SIZE(1)
|
||||
);
|
||||
#endif /*! WIN32 */
|
||||
#endif /* !WIN32 */
|
||||
static Sys_var_uint Sys_threadpool_max_threads(
|
||||
"thread_pool_max_threads",
|
||||
"Maximum allowed number of worker threads in the thread pool",
|
||||
GLOBAL_VAR(threadpool_max_threads), CMD_LINE(REQUIRED_ARG),
|
||||
VALID_RANGE(1, UINT_MAX), DEFAULT(3000), BLOCK_SIZE(1),
|
||||
VALID_RANGE(1, UINT_MAX), DEFAULT(500), BLOCK_SIZE(1),
|
||||
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
|
||||
ON_UPDATE(fix_tp_max_threads)
|
||||
);
|
||||
|
@ -1,12 +1,9 @@
|
||||
|
||||
/* Threadpool parameters */
|
||||
#ifdef _WIN32
|
||||
extern uint threadpool_min_threads; /* Minimum threads in pool */
|
||||
#else
|
||||
extern uint threadpool_idle_timeout; /* Shutdown idle worker threads after this timeout */
|
||||
extern uint threadpool_size; /* Number of parallel executing threads */
|
||||
extern uint threadpool_stall_limit; /* time interval in 10 ms units for stall checks*/
|
||||
#endif
|
||||
extern uint threadpool_max_threads; /* Maximum threads in pool */
|
||||
|
||||
/*
|
||||
|
@ -17,13 +17,11 @@ extern void thd_cleanup(THD *thd);
|
||||
extern void delete_thd(THD *thd);
|
||||
|
||||
/* Threadpool parameters */
|
||||
#ifdef _WIN32
|
||||
|
||||
uint threadpool_min_threads;
|
||||
#else
|
||||
uint threadpool_idle_timeout;
|
||||
uint threadpool_size;
|
||||
uint threadpool_stall_limit;
|
||||
#endif
|
||||
uint threadpool_max_threads;
|
||||
|
||||
|
||||
@ -127,7 +125,7 @@ int threadpool_add_connection(THD *thd)
|
||||
thd->net.reading_or_writing= 1;
|
||||
}
|
||||
}
|
||||
|
||||
thd->skip_wait_timeout= true;
|
||||
thread_detach(thd, psi_thread);
|
||||
return retval;
|
||||
}
|
||||
|
@ -1198,7 +1198,6 @@ bool tp_init()
|
||||
DBUG_ENTER("tp_init");
|
||||
started = true;
|
||||
scheduler_init();
|
||||
skip_net_wait_timeout= 1;
|
||||
if (threadpool_size == 0)
|
||||
{
|
||||
threadpool_size= my_getncpus();
|
||||
|
@ -520,7 +520,6 @@ bool tp_init(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
skip_net_wait_timeout = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user