diff options
Diffstat (limited to 'sql/threadpool_generic.cc')
-rw-r--r-- | sql/threadpool_generic.cc | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/sql/threadpool_generic.cc b/sql/threadpool_generic.cc index 400d072df3c..e630b5b5782 100644 --- a/sql/threadpool_generic.cc +++ b/sql/threadpool_generic.cc @@ -19,6 +19,7 @@ #include <sql_class.h> #include <my_pthread.h> #include <scheduler.h> +#include <algorithm> /* std::max*/ #ifdef HAVE_POOL_OF_THREADS @@ -984,23 +985,24 @@ end: The actual values were not calculated using any scientific methods. They just look right, and behave well in practice. - - TODO: Should throttling depend on thread_pool_stall_limit? */ + +#define THROTTLING_FACTOR (threadpool_stall_limit/std::max(DEFAULT_THREADPOOL_STALL_LIMIT,threadpool_stall_limit)) + static ulonglong microsecond_throttling_interval(thread_group_t *thread_group) { int count= thread_group->thread_count; - if (count < 4) + if (count < 1+ (int)threadpool_oversubscribe) return 0; - + if (count < 8) - return 50*1000; - + return 50*1000*THROTTLING_FACTOR; + if(count < 16) - return 100*1000; - - return 200*1000; + return 100*1000*THROTTLING_FACTOR; + + return 200*100*THROTTLING_FACTOR; } |