mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +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_ENTER("my_net_set_read_timeout");
|
||||||
DBUG_PRINT("enter", ("timeout: %d", timeout));
|
DBUG_PRINT("enter", ("timeout: %d", timeout));
|
||||||
|
if(net->read_timeout == timeout)
|
||||||
|
DBUG_VOID_RETURN;
|
||||||
net->read_timeout= timeout;
|
net->read_timeout= timeout;
|
||||||
#ifdef NO_ALARM
|
#ifdef NO_ALARM
|
||||||
if (net->vio)
|
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_ENTER("my_net_set_write_timeout");
|
||||||
DBUG_PRINT("enter", ("timeout: %d", timeout));
|
DBUG_PRINT("enter", ("timeout: %d", timeout));
|
||||||
|
if(net->write_timeout == timeout)
|
||||||
|
DBUG_VOID_RETURN;
|
||||||
net->write_timeout= timeout;
|
net->write_timeout= timeout;
|
||||||
#ifdef NO_ALARM
|
#ifdef NO_ALARM
|
||||||
if (net->vio)
|
if (net->vio)
|
||||||
|
@ -749,6 +749,7 @@ THD::THD()
|
|||||||
derived_tables_processing(FALSE),
|
derived_tables_processing(FALSE),
|
||||||
spcont(NULL),
|
spcont(NULL),
|
||||||
m_parser_state(NULL),
|
m_parser_state(NULL),
|
||||||
|
skip_wait_timeout(false),
|
||||||
#if defined(ENABLED_DEBUG_SYNC)
|
#if defined(ENABLED_DEBUG_SYNC)
|
||||||
debug_sync_control(0),
|
debug_sync_control(0),
|
||||||
#endif /* defined(ENABLED_DEBUG_SYNC) */
|
#endif /* defined(ENABLED_DEBUG_SYNC) */
|
||||||
|
@ -1697,6 +1697,9 @@ public:
|
|||||||
/* True if we want to log all errors */
|
/* True if we want to log all errors */
|
||||||
bool 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 */
|
/* container for handler's private per-connection data */
|
||||||
Ha_data ha_data[MAX_HA];
|
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"
|
the client, the connection is closed or "net_wait_timeout"
|
||||||
number of seconds has passed.
|
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);
|
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. "
|
"Number of concurrently executing threads in the pool. "
|
||||||
"Leaving value default (0) sets it to the number of processors.",
|
"Leaving value default (0) sets it to the number of processors.",
|
||||||
GLOBAL_VAR(threadpool_size), CMD_LINE(REQUIRED_ARG),
|
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(
|
static Sys_var_uint Sys_threadpool_stall_limit(
|
||||||
"thread_pool_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),
|
GLOBAL_VAR(threadpool_stall_limit), CMD_LINE(REQUIRED_ARG),
|
||||||
VALID_RANGE(60, UINT_MAX), DEFAULT(500), BLOCK_SIZE(1)
|
VALID_RANGE(60, UINT_MAX), DEFAULT(500), BLOCK_SIZE(1)
|
||||||
);
|
);
|
||||||
#endif /*! WIN32 */
|
#endif /* !WIN32 */
|
||||||
static Sys_var_uint Sys_threadpool_max_threads(
|
static Sys_var_uint Sys_threadpool_max_threads(
|
||||||
"thread_pool_max_threads",
|
"thread_pool_max_threads",
|
||||||
"Maximum allowed number of worker threads in the thread pool",
|
"Maximum allowed number of worker threads in the thread pool",
|
||||||
GLOBAL_VAR(threadpool_max_threads), CMD_LINE(REQUIRED_ARG),
|
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),
|
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
|
||||||
ON_UPDATE(fix_tp_max_threads)
|
ON_UPDATE(fix_tp_max_threads)
|
||||||
);
|
);
|
||||||
|
@ -1,12 +1,9 @@
|
|||||||
|
|
||||||
/* Threadpool parameters */
|
/* Threadpool parameters */
|
||||||
#ifdef _WIN32
|
|
||||||
extern uint threadpool_min_threads; /* Minimum threads in pool */
|
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_idle_timeout; /* Shutdown idle worker threads after this timeout */
|
||||||
extern uint threadpool_size; /* Number of parallel executing threads */
|
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_stall_limit; /* time interval in 10 ms units for stall checks*/
|
||||||
#endif
|
|
||||||
extern uint threadpool_max_threads; /* Maximum threads in pool */
|
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);
|
extern void delete_thd(THD *thd);
|
||||||
|
|
||||||
/* Threadpool parameters */
|
/* Threadpool parameters */
|
||||||
#ifdef _WIN32
|
|
||||||
uint threadpool_min_threads;
|
uint threadpool_min_threads;
|
||||||
#else
|
|
||||||
uint threadpool_idle_timeout;
|
uint threadpool_idle_timeout;
|
||||||
uint threadpool_size;
|
uint threadpool_size;
|
||||||
uint threadpool_stall_limit;
|
uint threadpool_stall_limit;
|
||||||
#endif
|
|
||||||
uint threadpool_max_threads;
|
uint threadpool_max_threads;
|
||||||
|
|
||||||
|
|
||||||
@ -127,7 +125,7 @@ int threadpool_add_connection(THD *thd)
|
|||||||
thd->net.reading_or_writing= 1;
|
thd->net.reading_or_writing= 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
thd->skip_wait_timeout= true;
|
||||||
thread_detach(thd, psi_thread);
|
thread_detach(thd, psi_thread);
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
@ -1198,7 +1198,6 @@ bool tp_init()
|
|||||||
DBUG_ENTER("tp_init");
|
DBUG_ENTER("tp_init");
|
||||||
started = true;
|
started = true;
|
||||||
scheduler_init();
|
scheduler_init();
|
||||||
skip_net_wait_timeout= 1;
|
|
||||||
if (threadpool_size == 0)
|
if (threadpool_size == 0)
|
||||||
{
|
{
|
||||||
threadpool_size= my_getncpus();
|
threadpool_size= my_getncpus();
|
||||||
|
@ -520,7 +520,6 @@ bool tp_init(void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
skip_net_wait_timeout = 1;
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user